+ Reply to Thread
Results 1 to 11 of 11

OleoObject name variable definition

  1. #1
    Forum Contributor
    Join Date
    06-15-2007
    Location
    Scotland
    Posts
    142

    Unhappy OleoObject name variable definition

    hI guys
    I am trying to generate a sub that read the name of a check box (which is in text format) in a spreadsheet in this case sheet13 and according to that ask if that check box which is in another sheet (sheet4) is true or false, I mean if it checked or not, then perform other actions

    But I am getting this following error
    Run time error ‘438’
    Object doesn’t support this property or method

    I tried several things but always get an error.
    Does some body know how to make the checkboxname variable a valid name for the checkbox object in sheet4?

    Best regard to all
    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    06-15-2007
    Location
    Scotland
    Posts
    142
    hello, does anybody have a light here?
    thanks folks

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Be easier if you'd share the line that has the error ...

    Is the checkbox from the Control Toolbox?
    Last edited by shg; 05-04-2008 at 07:24 PM.

  4. #4
    Forum Contributor
    Join Date
    06-15-2007
    Location
    Scotland
    Posts
    142
    sorry Shg, is because I am quite un expert with VBA some time is also difficult for me to explain the error.

    Yes is the checkbox from the control tool box the one that I would like to know how should be declared in order to pick the name from sheet13 in a workbook, and check if that checkbox, which is in sheet4, is cheeked or not.

    I declared checkboxname as an object
    Please Login or Register  to view this content.
    I also set checkboxname in sheet4 but I think that is a mistake
    Please Login or Register  to view this content.
    And then in the code I assign the value of a cell in sheet13 (text with the name of the check box in sheet4) to the variable checkboxname
    Please Login or Register  to view this content.
    To finally ask if that checkbox is tick or not in sheet4 to perform other things
    Please Login or Register  to view this content.
    If I use the name of the checkbox directly for example
    Please Login or Register  to view this content.
    works ok, but because there are several switches I was thinking to use a for routine intead of many if for each switch.
    I really appreciate any help with this.
    Best regards to all

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    I also set checkboxname in sheet4 but I think that is a mistake
    You're right, that's wrong; you set the object variable to the sheet, not the control.

    You can use any of these constructs:

    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    06-15-2007
    Location
    Scotland
    Posts
    142
    thanks for your time, but I still not getting the answer, and still having the trouble.
    I simplify the things as follow and I am attaching a zip file with the excel sheet. What I would like to to do in this example is read the name of the check box in sheet 13, ask if the check box (which are in sheet 4) value is true if it true the write in the next cell in sheet 13 "ok"


    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Remove the quotes around "checkboxname".

  8. #8
    Forum Contributor
    Join Date
    06-15-2007
    Location
    Scotland
    Posts
    142
    Hello, I did that but I get this error. Run time error 1004
    method oleobjects of object _Worksheet failed.

    I am not sure why I am getting that error but highlight the following line in the code
    Please Login or Register  to view this content.
    is like is not recognizing the checkboxname as a text

    do you have any other suggestion?
    cheers

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    You only have three checkboxes, but 10 cells thant contain checkbox names. It errors on the fourth cell, as you would expect.

  10. #10
    Forum Contributor
    Join Date
    06-15-2007
    Location
    Scotland
    Posts
    142

    Red face

    what a newbie.
    many thanks for the help

  11. #11
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Been there, you're welcome.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1