View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Command Button on worksheet

Are you trying to change the caption when you click on that button?

If yes, I used this macro that was assigned to a button from the Forms toolbar:

Option Explicit
Sub testme()
Dim myBTN As Button
Set myBTN = ActiveSheet.Buttons(Application.Caller)
myBTN.Caption = "Hi there" & vbLf & Now
End Sub

Each time I clicked on the button, the caption changed to include the current
time.

If you want to change the caption for any button, you can be explicit:

activesheet.buttons("Button 1").caption = "Whatever you want"




Jack wrote:

I have created a command button on a worksheet and have assigned a macro to
it. It works fine.
Is there a way I can access the caption of this button using VBA. I cant
find where this object fits within the commandbars structure.
I just dont know how to access it since it is not part of a toolbar.
Jack


--

Dave Peterson