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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

button remove itself

Status
Not open for further replies.

llamaman

Programmer
Jan 9, 2002
49
US
I need a button on a MS Word template to remove itself when it is clicked.
Set ButtonName = Nothing doesn't work
Unload ButtonName also doesn't work
Any suggestions
 
Hi!

You can set the visible property to false, but I think you would need to change the focus first.

hth
Jeff Bridgham
bridgham@purdue.edu
 
The button does not appear to have a visible property ...
 
Is the button created from the Control Toolbox (ActiveX) or is from the Forms toolbar. If it is from the control toolbox it can be set to invisible. Try

Private Sub CommandButton1_Click()
Me.CommandButton1.Visible = False
MsgBox "I'm gone"
End Sub

If it is from the Forms toolbar, you can delete it by something like

ActiveDocument.Shapes("Button 1").Delete.

A.C.
 
I'm using the control toolbar, but I do not get the "visible" command in my smarttext dropdown, nor does it work if I force it. I'm using Office 97--does that make a difference?

Thanks,
Llamaman
 
llamaman,

sorry for the late response.

Have you actually placed the cod ein the relevant sheet codepane rather than a general module ?

I have tested it on XL97 and it seems to work ok. Right click on the sheet with the control, and select view code. Insert the code in th eresultant window.

A.C.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top