Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

button in excel 1

Status
Not open for further replies.

smiley0q0

Technical User
Feb 27, 2001
356
US
how do i make a cmd button not be visible in code?
 
i tried that, and it gives me the error

"Run Time Error '424':"

"Object Required"
 
Are you placing the code in the sheet that the button is.
Ie. if button is on sheet1, is the code also in sheet1?

Nick
 
no, it's in a module, but i have selected the sheet that it is in.
 
i want to make it not visible once it has been clicked, but when the worksheet is opened again i want it to be visible. when you asked if the code was in the sheet that the button was in, i put it in there after my call statement, like this

Private Sub CmdUpdate_Click()
Call Filter
CmdUpdate.Visible = False
End Sub
now that works fine. (filter is the macro in the module)

now i don't know where to put the code to have it be visible when the workbook opens

it gives me an error if i try this in the sheet that the button is in...

Private Sub Workbook_Open()
CmdUpdate.Visible = True
End Sub

Thank you for your help.

Smiley B-)
 
I can't seem to work this out. If no-one else responds to this tonite, I will take a look at work tomorrow.
You say:
"now i don't know where to put the code to have it be visible when the workbook opens"
Does the workbook get closed at some point? The when the workbook gets reopened, make the button visible again?

Nick
 
The only way I know of is the hide them all, then use a Alt key combination to turn them back on.

ActiveWorkbook.DisplayDrawingObjects = xlHide

This probably isn't much help, but it's all I could think of.
 
Private Sub Workbook_Open()
sheet1.CmdUpdate.Visible = True
End Sub

Where sheet1 id the name of the sheet where your cmdUpdate button is.

Could u let me know if this works please? It has worked fine on my pc.

Nick
 
Nick,
that works perfectly!!!
That deserves a star :-D

Thank you.

Smiley B-)
 
Maybe one you can help me.
Im having problems correctly troubleshooting for greyed out option buttons that are located along the top bar when in print preview in office 97. If you have any Ideas beside uninstalling and reinstalling please let me know.

Thanks
Syd.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top