Dynamically add a Checkbox and change its Caption

J

jd

I'm able to add a checkbox to word with the following code. However,
I've been unable to change the checkbox "caption". Anyone know how to
do this?

Sub InsertCheckBox()
Dim wdApp As Word.Application
Set wdApp = New Word.Application
wdApp.Documents.Add
wdApp.Visible = True

wdApp.ActiveDocument.ToggleFormsDesign
wdApp.Selection.InlineShapes.AddOLEControl
ClassType:="Forms.CheckBox.1"

End Sub
 
D

Doug Robbins - Word MVP

Use:

Set myOB = ActiveDocument.Shapes _
.AddOLEControl(ClassType:="Forms.CheckBox.1")
With myOB.OLEFormat
.Activate
Set myObj = .Object
End With
With myObj
.Caption = "My Checkbox"
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top