Solved

Send Form Check Box to Document via VBA

Posted on 2009-07-13
5
371 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

The Selection object is designed for user interaction. It has a Range property, so it can be used in most places that a Range object can. Recorded macros must use the Selection because they are simply copying what the user is doing. A Range prope…
Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

752 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