I have the following VBA code that adds a command button to a spreadsheet:
But this code defaults the button caption to "CommandButton1" and I want to change the caption. I tried the following, but it produced an error message when I ran it:
How can I set the caption on the button?
Thanks.
Code:
indexWorksheet.OLEObjects.Add ClassType:="Forms.CommandButton.1", Left:=0, Top:=0, Width:=126.75, Height:=25.5
But this code defaults the button caption to "CommandButton1" and I want to change the caption. I tried the following, but it produced an error message when I ran it:
Code:
indexWorksheet.OLEObjects.Add ClassType:="Forms.CommandButton.1", Caption:="Click Me", Left:=0, Top:=0, Width:=126.75, Height:=25.5
How can I set the caption on the button?
Thanks.