Solved

Word 2010 - checkboxes with automatic autofil

Posted on 2013-06-24
1
540 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Nice table. Huge mess. Maybe this was something you created way back before you figured out tabs or a document you received from someone else. Either way, using the spacebar to separate the columns resulted in a mess. Trying to convert text to t…
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
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:

708 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

12 Experts available now in Live!

Get 1:1 Help Now