-
How do you change the properties of a command button... Checkbox... in a VBA app that these items are Dynamically created.
Example:
User opend doc, selects this type and VBA creates next from based on the previous information
This is in MSWord if it helps any,
Code that I have so far:
Selection.InlineShapes.AddOLEControl ClassType:="Forms.CommandButton.1"
This Creates the Object in the document, How can I change the caption on the Button?
-
I beleive all the VBA is the same therefore:
CommandButton1.setfocus
CommandButton1.caption = "New Caption"
you have to have the name of the command button, then you set focus to it and rename the caption.
-
I wish it was that simple, I did try that and I the get and object required error 424
Any other Ideas?
-
Hi, Spyder.
Try this:
Dim myCB As Object
Set myCB = ActiveDocument.Shapes.AddOLEControl(ClassType:="Forms.CommandButton.1")
With myCB.OLEFormat.Object
.Caption = "Check if over 21"
End With
Larisa
-