Microsoft Office Forums Check Box Form Field Book Mark Auto Fill?
 Register FAQ Search Today's Posts Mark Forums Read

#1
08-20-2014, 12:40 PM
 zacam87 Windows 7 64bit Office 2010 32bit Novice Join Date: Aug 2014 Posts: 3
Check Box Form Field Book Mark Auto Fill?

Hi,

I'm wondering if there is a way to auto-fill all check box form field bookmarks (in field settings) in a document? I have a document template with about 3,500 check box form fields, and I'm trying to write a macro in Excel to auto populate an Excel sheet based off of which check boxes are marked. I don't really care what the actual bookmark names are, but each one does need to be unique. If possible I'd like to use numbers 1 - 3,500 but I don't think that's possible.

Thanks!
Z
#2
08-20-2014, 01:42 PM
 macropod Windows 7 64bit Office 2010 32bit Administrator Join Date: Dec 2010 Location: Canberra, Australia Posts: 21,230

First you say you want to "auto-fill all check box form field bookmarks (in field settings) in a document", but checkboxes only have true/false states.

Then you say you want to "write a macro in Excel to auto populate an Excel sheet based off of which check boxes are marked".

What are you trying to populate? Word or Excel?

As for "I'd like to use numbers 1 - 3,500 but I don't think that's possible", why does it matter whether they're bookmarked?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
#3
08-20-2014, 01:47 PM
 zacam87 Windows 7 64bit Office 2010 32bit Novice Join Date: Aug 2014 Posts: 3

I'm sorry if you didn't understand my post.

Basically I'm trying to auto populate the bookmarks for 3500 checkbox formfields in a Word document.

Currently none of the checkbox field settings have bookmarks defined, I need each of the 3500 checkboxes to have a unique bookmark defined - preferably automatically... something like check1, check2, check3... check3500

Hope this helps

Thanks!
#4
08-20-2014, 02:03 PM
 macropod Windows 7 64bit Office 2010 32bit Administrator Join Date: Dec 2010 Location: Canberra, Australia Posts: 21,230

It is a bit hard to understand what you want when you say things like "a macro in Excel to auto populate an Excel sheet"...

You still haven't explained what bookmarking the checkboxes is supposed to achieve. If they're in the same order as the data in the Excel workbook, there doesn't seem to be any need for that. Indeed, relying them is likely to increase your maintenance overheads.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
#5
08-20-2014, 02:23 PM
 zacam87 Windows 7 64bit Office 2010 32bit Novice Join Date: Aug 2014 Posts: 3

The Excel workbook essentially has a single cell associated with each checkbox in the Word document. The word document has a group of 12 check boxes per item. The first checkbox in the word document associates with cell B4, second checkbox with cell C4, third checkbox with cell D4 etc. to M4. Then it transitions to B5, C5, D5... M5 etc.

The Excel macro I've been testing to pull the data out of the Word document is:

Code:
Sub wrd12()
Dim wrd As Word.Application
Set wrd = CreateObject("Word.Application")
With wrd
.Documents.Open "C:\path\to\word.docx"
.Visible = True

End With
Range("b4").Value = wrd.ActiveDocument.FormFields("check1").Result
Range("c4").Value = wrd.ActiveDocument.FormFields("check2").Result
Range("d4").Value = wrd.ActiveDocument.FormFields("check3").Result
Range("e4").Value = wrd.ActiveDocument.FormFields("check4").Result
Range("f4").Value = wrd.ActiveDocument.FormFields("check5").Result
Range("g4").Value = wrd.ActiveDocument.FormFields("check6").Result
All the way to cell M350~ / the end of the document. The format in the Excel sheet isn't necessarily a straight row or column which is why I was looking to bookmark each check box accordingly, however manually entering bookmarks for some 3000~ check boxes leaves a lot of room for error and is time consuming - so I'd like to automate the bookmarking of the check boxes. If there's a better way I should be looking at this please let me know.

Thanks
#6
08-20-2014, 02:56 PM
 macropod Windows 7 64bit Office 2010 32bit Administrator Join Date: Dec 2010 Location: Canberra, Australia Posts: 21,230

If the checkboxes are the only formfields in the document, you could use:
Range("b4").Value = wrd.ActiveDocument.FormFields(1).Result
Range("c4").Value = wrd.ActiveDocument.FormFields(2).Result
Range("d4").Value = wrd.ActiveDocument.FormFields(3).Result
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]

 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post stct Word 26 06-15-2019 04:08 PM Dsp581 Word 3 04-04-2013 11:27 PM Nccadm Mail Merge 2 04-02-2013 03:15 AM jkeeney Word 1 03-21-2012 12:21 AM Gail L. Word 2 05-17-2009 12:38 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:45 PM.

 -- Default Style -- Lightweight -- New Mobile Contact Us - Privacy Statement - Top