Removing Command Button

S

SS

I am having a terrible time getting my command buttons to
work.

It does not seem to even recognize my Click event.

Sub A()

ActiveSheet.OLEObjects.Add
(ClassType:="Forms.CommandButton.1", Link:=False _
, DisplayAsIcon:=False, Left:=300, Top:=250,
Width:=125, Height:= _
50).Select

ActiveSheet.OLEObjects("CommandButton1").Object.Caption
= "Run Me"

End Sub

Sub CommandButton1_Click()
ActiveSheet.OLEObjects("CommandButton1").Object.Visible =
False
End Sub

Any Suggestions?

Thanks

SS
 
B

Bob Phillips

Is the click event code in the worksheet code module.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top