Consulting

Results 1 to 6 of 6

Thread: Making an ActiveX control button inactive?

  1. #1
    VBAX Regular
    Joined
    Jun 2005
    Posts
    95
    Location

    Making an ActiveX control button inactive?

    Hi all,

    This is probably a really simple thing to do and I know it is possible because I see it all the time with the "APPLY" button in Windows. I need to be able to select an ActiveX button and make it inactive in the process of running a macro. Thanx in advance for your help.

    Scott

  2. #2
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Try this.


    CommandButton1.Enabled = False

  3. #3
    VBAX Regular
    Joined
    Jun 2005
    Posts
    95
    Location
    Thank you Jake, I tried this;

    ActiveSheet.Shapes("Button 11").Select
        CommandButton1.Enabled = False
    That returns an error that reads " Run time error '424' object required"
    What does that mean and how do I make it work properly?

    Thanx for your help

    Scott

  4. #4
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    The error means that the object that you referenced (in this case CommandButton1) does not exists.

    You need to use the ActiveX Command Button control instead of the Forms Button.

    You can get the Command Button control from the Control Toolbox on the Visual Basic toolbar.

    When you use this line:


    CommandButton1.Enabled = False

    CommandButton1 must be the name of the control. Change as needed.

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Quote Originally Posted by infinity

    ActiveSheet.Shapes("Button 11").Select
        CommandButton1.Enabled = False
    That returns an error that reads " Run time error '424' object required"
    What does that mean and how do I make it work properly?
    With ActiveSheet.Buttons("Button 11")
            .Enabled = False
        End With
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    VBAX Regular
    Joined
    Jun 2005
    Posts
    95
    Location
    Did I mention you all are awesome?
    Quote Originally Posted by xld

    With ActiveSheet.Buttons("Button 11")
    .Enabled = False
    End With
    Thank you this worked exactly the way I wanted it to. Thanx again

    Scott

Posting Permissions

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