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

naming a checkbox in Word

Status
Not open for further replies.

nochoice

Programmer
Jun 17, 2003
72
CA
I have added a checkbox, I want to change its name and caption, the problem is when it is added, I don't know its name, how can I go about changing a checkbox's name when I first add it? Here is my code to add the checkbox:

Selection.InlineShapes.AddOLEControl ClassType:="Forms.CheckBox.1"

 
Hi,

Just after you ADD, that object is selected. So...
Code:
Selection.InlineShapes.AddOLEControl ClassType:="Forms.CheckBox.1"
With Selection
' do yer stuff to the object
End With


Skip,
Skip@TheOfficeExperts.com
 
this works for almost all of the checkbox's properties except Name. Wen I try to rename it I get a 'Can't assign to read-only property' Is there any way to make the Name property not read-only?
 
You can click on the checkbox, then rightclick and select "properties", you should then be able to change both the name and the caption.
 
It looks like I was wrong in the above post. It doesn't work with any of the checkbox's properties. Here is my code:

'=================================
Selection.InlineShapes.AddOLEControl ClassType:="Forms.CheckBox.1"
With Selection
Name = "Foo Bar"
Value = True
Caption = "Hello World!"
End With
'=================================


What I get is an error that name is 'read-only' (as I said before). So I commented it out. When it is commented out, nothing happens, no error, however, no value or caption change either.

If I a put a period before value or caption I get a 'method or data member not found' error.

I've looked everywhere for this. Any suggestions would be great.

Thanks

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top