Please Help: change caption of command button

gaw
06-12-2001, 02:57 PM
Hi,
I used VBA to create a command button with a statement like:

ActiveWindow.Selection.SlideRange.Shapes.AddOLEObject(Left:=66#, Top:=486#, Width:=108#, Height:=24#, ClassName:="Forms.CommandButton.1", Link:=msoFalse).Select

By default, the caption is alway "CommandButton1". I wanted its caption changed like "Search". It is easy to do it manually, but I have been spent the whole afternoon trying to have it done by another few lines of VBA statement. Please help.... Thank you very much.
Gang

rsouthon
06-12-2001, 03:48 PM
If you add the question in the following way you can access all the properties of the checkbox and its shape:

Dim m_shape As InlineShape
Dim m_command As MSForms.CommandButton

Set m_shape = Selection.InlineShapes.AddOLEControl(ClassType:="Forms.CommandButton.1")
Set m_command = m_shape.OLEFormat.Object

m_command.Caption = "Search"


The only problem is the performance.

Rob

gaw
06-12-2001, 03:55 PM
Thanks a lot!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum