
Export text boxes in Word form to Excel or access
Hi Fletcher,
I hope you have some time available to get this up and running ;-)
See comments inline
Quote:
> 1. Will VBA "recognize" each text box based on the "bookmark" value? So, if
> I give a box the bookmark of "CustomerName", can I then you VBA to say,
> "take the value in the CustomerName box and put it in this column in Excel
> (or Access)."
Yep. Try:
MsgBox ActiveDocument.Formfields("CustomerName").Result
to get the result of a specific formfield
Quote:
> 2. Once I figure out the above (a bit of example code would be very
> appreciated), I want to apply that code to 300 + documents that are in a
> given folder on our file server, can this be done? Any hints?
See some example code to process all the files in a specific folder at
http://www.mvps.org/word/FAQs/MacrosVBA/BatchFR.htm
Quote:
> 3. Where it says "run macro on entry", does it mean on entry of text? If so,
> do I ahve to have a separate code module for each text box, or can I just
> make a little subroutine for each text box and tell it to "run the
> subroutine called xxxx".
It's both possible. You can write separate routines for separated formfields, or you can write a general procedure that uses the name of a selected formfield. Some example code on how to get the name of that field at:
http://www.mvps.org/word/FAQs/TblsFldsFms/GetCurFmFldName.htm
I would like to be able to export this data
Quote:
> into a searchable access database (also new to access, hope I'm not getting
> in over my head). So, I have a few questions:
If this is what you're planning to do, I suggest you won't run any code after leaving or entering any formfield. Just write the whole buch when you're ready. Start a routine which does that by pressing a button or automatically whenever the file is saved for example.
For some code examples on how to write stuff into Excel , see:
http://www.mvps.org/word/FAQs/InterDev/ControlXLFromWord.htm
If it is Access that you want, we need to know the Office version you're using.
Hope this helps,
regards,
Astrid
So that all can benefit from the discussion, please post all follow-ups to the newsgroup.
Visit the MVP Word FAQ site at http://www.mvps.org/word/