Solved

Word 2010 - checkboxes with automatic autofil

Posted on 2013-06-24
1
548 Views
Last Modified: 2013-06-24
Hello All:

I'm creating an Word Document and have 7 separate tables ( 1 table attached for reference ).  I am using 'autofield' for the auto fill so after the separate 7 tables ; It would autosum to equal on an separate table.  

My problem is I have checkboxes that when checked, need to update the 'autofield' with the appropriate number. I've used multiple macros & nothing worked so I've deleted all macros and starting fresh so any help would be greatly appreciated.  

I've also attached 2 examples.
attachment.png = Orange circle is autofield needed for autosum
example1.png = Checked 5 and autofilled #5
example2.png = Checked 3 and autofilled #3
attachment.PNG
example1.PNG
example2.PNG
0
Comment
Question by:synertia
1 Comment
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 500 total points
ID: 39271371
It is difficult to be sure from your description and just pictures, but I am guessing that you are using form fields.

If you change the bookmark names of the fields to something like quantity_5, quantity_4 etc., you can use a macro like this and set it to be the exit macro for each of the checkboxes.
Sub FillField()
Dim ffldCheck As FormField
Dim ffldText As FormField
Dim strName  As String
Dim strNumber As String

Set ffldCheck = Selection.FormFields(1)
strName = Split(ffld1.Name, "_")(0)
strNumber = Split(ffld1.Name, "_")(1)

Set ffldText = ActiveDocument.FormFields(strName)

If ffldCheck.CheckBox.Value = True Then
    ffldText.Result = strNumber
Else
    ffldText.Result = ""
End If

End Sub

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Do you ever need to create a 20 page Word document for some testing purpose? Are you tired of copying & pasting old boring "lorem ipsum" text over and over again, increasing font size and line space in order to make the document 20+ pages long? Look…
If you work with Word a lot, you probably use styles. If you use styles a lot, you've probably balled your fist more often than not when working with the ribbon. In Word 2007/2010, one of the things that I find missing when using styles is a quic…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.

839 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