Solved

Send Form Check Box to Document via VBA

Posted on 2009-07-13
5
362 Views
Last Modified: 2012-06-27
I want to insert checked!! check boxes into a Word Form.
How can I do this using VBA and {formcheckbox}. btw: Not using the Insert Checkbox-Button inserts a Field where I cannot set properties for the box later. It says that this field was not inserted by the button ??! What kind of document-automation limitation is that - I can't grab any sense of it.
What can I do?
Chris
0
Comment
Question by:chriswies
  • 3
  • 2
5 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 24838875
It isn't clear exactly what you are doing, but the InsertCheckBox Sub in the snippet should insert a checkbox and set its value. The CallInsertCheckBox Sub shows the usage.
Sub CallInsertCheckBox()

    InsertCheckBox ActiveDocument.Bookmarks("\EndOfDoc").Range

End Sub
 

Sub InsertCheckBox(rng As Range)

    Dim ffld As FormField

    Set ffld = ActiveDocument.FormFields.Add(rng, wdFieldFormCheckBox)

    ffld.CheckBox.Value = True

End Sub

Open in new window

0
 

Author Comment

by:chriswies
ID: 24838903
hm, ok, I get it.
The way I do it now via automation is by .insertfield because users can configure their fields for the text.
Wanting to use .insertfield you probably say that it is impossible, right?
Chris
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 24839496
I'm not sure that I understand. I don't think that there is an InsertField method
0
 

Author Comment

by:chriswies
ID: 24839559
sorry, i recalled from memory. It is VBA "fields.add ".
Chris
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 24840110
I cannot find a way of adding a FormField to the Fields collection. It mus be added to the FormFields collection.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

There is a feature provided by MS Word that lets you create an Table of Contents for your Word document automatically. To use this feature for other documents there are two steps involved,   1.  Prepare your document for a table of contents (he…
Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
This video walks the viewer through the process of creating a watermark for their document, customizing it, and saving it for viewing/printing needs.
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now