Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2007

Tip: Looking for answers? Try searching our database.

Dynamically add a Checkbox and change its Caption

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jd - 21 Sep 2007 02:52 GMT
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
Doug Robbins - Word MVP - 22 Sep 2007 01:44 GMT
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

Signature

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

> 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
[quoted text clipped - 11 lines]
>
> End Sub
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.