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

Changing CommandButton Properties with VBA

Status
Not open for further replies.

jclarkpowereng

Programmer
Nov 11, 2003
5
US
I am adding a commandbutton to a Excel worksheet with the following command:

OutputSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False,
DisplayAsIcon:=False, Left:=150, Top:=1330, Width:=200, Height:=50).Select

It adds the button and names it "CommandButton1".

I want to rename that button (the caption that appears on the button face)
and assign a macro to the button that will run when someone pushes the
button - and am having a hard time doing that with code.

Can you offer any suggestions?
 
You want the VBA Forum: forum707. We are VB 5 and 6 here.

Andy
"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
"A computer program does what you tell it to do, not what you want it to do." -- Greer's Third Law
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top