Before you get all wrapped around the axle,
It sounds like Leith's information is a bit dated. there was a problem with
this in xl97, so if you are using xl97 it is a bit more complex, but you can
still change the code name of the commandbutton. I assume you are not
working with excel 97 and as your subject states, this code is run from a
userform module. In that case the unqualified name cmdStartWizard is seen
to refer to the Userform where there is no such control.
It sounds like the only thing you need to do is qualify the name of the
command button with a reference to the sheet so Excle knows where it is.
Activesheet.cmdStartWizard.Enabled = False
ActiveSheet.cmdStartWizard.Caption = "Quote Wizard Disabled," & Chr(13) & "
please use editing
-------------- if it isn't the activesheet, then assume it is on Sheet3
Worksheets("Sheet3").Activesheet.cmdStartWizard.En abled = False
Worksheets("Sheet3").ActiveSheet.cmdStartWizard.Ca ption = "Quote Wizard
Disabled," & Chr(13) & " please use editing
---------------------------
Here is a little demo from the immediate window to prove the point. I have
one button on Sheet1 named CommandButton1
' check the name by displaying the caption
? Activesheet.CommandButton1.Caption
CommandButton1
'Change the name to cmdStartWizard
Activesheet.CommandButton1.Name = "cmdStartWizard"
' Now use the new name to check the caption
? activesheet.cmdStartWizard.Caption
CommandButton1
' Now use the new name to work with the control
' by changing the caption
activesheet.cmdStartWizard.Caption = "HokeyPokey"
' Verify that it is changed
? activesheet.cmdStartWizard.Caption
HokeyPokey
--
Regards,
Tom Ogilvy
"Leith Ross" wrote
in message ...
Hello Amber_D_Laws,
If you created the command button from the Excel menu then it is a
Forms type. If you created it using the VBA Toolbar then it is a
Control Toolbox type. If you still aren't sure, try each code version.
You are correct about the name needing to be changed to CommandButton1.
When you change the name of the control, it only effects the project
references, not the system reference.
Sincerely,
Leith Ross
--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile:
http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=507754