Solved

Send Form Check Box to Document via VBA

Posted on 2009-07-13
5
369 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I'm writing to share my clumsy experience in using this elegant tool so you can avoid every stupid mistake I made. (I leave it to the authorities to decide if this deserves a place in the Knowledge archives.)  Now that I am on the other side of my l…
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 shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
This Micro Tutorial well show you how to find and replace special characters in Microsoft Word. This is similar to carriage returns to convert columns of values from Microsoft Excel into comma separated lists.

856 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