Solved

Word 2010 - checkboxes with automatic autofil

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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

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…
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…
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.
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

729 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