+ Reply to Thread
Results 1 to 9 of 9

Disable a form button

  1. #1
    Registered User
    Join Date
    05-15-2007
    Posts
    17

    Disable a form button

    Greetings,

    I have a single-sheet workbook, with a button called "Copy Order". How can I disable it? I found this code elsewhere:

    Please Login or Register  to view this content.
    but when I run it, I get an error that says "Object doesn't support this property or method."

    I am running Excel in Office 2001 for Mac.

    Thanks!
    DM
    Office 2001 Mac version

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    Try this syntax
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-15-2007
    Posts
    17
    Hi Mike,

    I tried your suggestion, and got this:

    Run-time error '1004':

    Unable to get the Buttons property of the Worksheet class.
    Any other ideas on how I can get this happenin'?

    Thanks for your help!
    DM

  4. #4
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good morning doctormelodious

    Try this :

    Please Login or Register  to view this content.
    This should disable the button, but if you are using buttons from the Forms toolbar, it won't be greyed out, as Control Toolbox controls are, it just won't work when clicked on. If you want that functionality you'll need to use the Control Toolbox toolbar.

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  5. #5
    Registered User
    Join Date
    05-15-2007
    Posts
    17
    Hey Dominic,

    Thanks. That did the trick!

    I've been trying to find a list of properties and methods for shapes, but am not having any luck. Can you point me towards this?

    Specifically, is there something akin to a "visible" property that would enable me to show/hide a shape?

    EDIT: Ack! how come as soon as I post, I end up FINALLY finding the info I was looking for??

    http://msdn2.microsoft.com/en-us/lib...ffice.11).aspx

    Thanks again,
    DM
    Last edited by doctormelodious; 05-16-2007 at 07:39 PM.

  6. #6
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    Please Login or Register  to view this content.
    will toggle the visibility of button 1. When invisible, it cannot be clicked.

  7. #7
    Registered User
    Join Date
    05-15-2007
    Posts
    17
    Thanks Mike,

    Okay, now here's what's got me stumped. I have created two of these buttons. One would assume that the second button would be "Button 2". But the code you gave me only works when I put "Button 1" in it. I can't make the other button invisible. Putting "Button 2" in gets:

    Run-time error '5':

    Invalid procedure call or argument

    I also tried referring to the button by its name text, but that failed too.

    Where do I find out the internal names by which VB refers to these buttons? Opening their Properties just gives me stuff relating to positioning and printing.

    Thanks!
    DM

  8. #8
    Registered User
    Join Date
    05-15-2007
    Posts
    17
    Oh Geez... that's TWICE in one thread!!

    I found it. The second button is somehow "Button 34"!

    Peas-Out,
    DM

  9. #9
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    That means that it was the 34th object created on that sheet.

    Create Button it will be Button 1
    Draw Squate it will be Rectange 2
    Create CheckBox it will be CheckBox 3
    Create Button it will be Button 4

+ 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