Getting the value of an unbookmarked checkbox

M

mdb

I have hundreds of forms I've been tasked to extract data from into an
Excel spreadsheet. The VBA script I developed performs the task well,
but it depends entirely upon the Bookmark name to retrieve values that
are Checkbox and Textbox. Turns out that four checkboxes on all these
forms were somehow created without a Bookmark name, so VBA has nothing
to grab onto, thereby skipping those fields. I've tried modifying my
script to do a Selection.Find and writing the resulting Selection.Text
to the Excel Object, but this only gets me the FACT that there is a Yes
and a No, not which one is actually checked. However, if I manually
Select, then copy to Notepad or any other Text Editor, what gets pasted
is, for example, Yes 1 No 0.

That I could work with. What I've been unable to find is a way to open
up a Notepad or other Text Editor object that would allow the VBA
script open Word doc/find/select/copyto clipboard/goto already open
Text Editor/paste/go back to Word object/close Wobj/ open next W doc.
That is to say, I've got everything except '...goto already open Text
Editor/paste/go back to Word object...' figured out. I don't need
step-by-step, just yes/no if it's possible and if so, high level how to
do it. Even Google keywords suggestions would help, I seem to have
exhausted my keywords.

OR if there's a way in VBA to pick up the value of UNbookmarked
checkboxes, I'd be forever grateful for pointers in that direction. My
boss is making noises about me having to go into over 600+ Word
documents, to retrieve the information manually, and if that happens,
I'll need someone to post bail.
 
D

Dave Lett

Hi,

Can you use something like the following:

Dim iFld As Integer

For iFld = 1 To ActiveDocument.FormFields.Count
If ActiveDocument.FormFields(iFld).Type = wdFieldFormCheckBox Then
'''run your routine here
End If
Next iFld


HTH,
Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top