Export text boxes in Word form to Excel or access 
Author Message
 Export text boxes in Word form to Excel or access

Hello -

New to Word VBA, just got a book on it actually. I'm a Systems Admin. by
trade, but this programming stuff is pretty new to me... Before I dig into
the whole book I was going to see if any of you experts could get me started
on something:

I have some simple word forms with items such as text input boxes, yes/no
check boxes, drop down boxes, etc... I ahve seen that you can give each text
box field a 'bookmark' value, and also that you can run macros on entry and
exit. I have about 300 "completed" (filled out) forms for my small business
and they are growing each day... I would like to be able to export this data
into a searchable access database (also new to access, hope I'm not getting
in over my head). So, I have a few questions:

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)."

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?

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".

I'll stop there for now, because I know I am being really demanding since I
don't know squat here, just wanting to hear from you all if what I am trying
to do is even possible before I get too crazy with these ideas.

Thanks!!

PS - I would be happy to email the form to anyone who want sto have a look
to really see what I am talking about.



Thu, 12 Aug 2004 05:03:21 GMT  
 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/



Fri, 13 Aug 2004 06:29:36 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Created Form in Word - Irregular movement of combo boxes, text boxes on scrolling

2. Exporting Word form field data into Excel?

3. Export text boxes into access database

4. using VB text boxes data but not text boxes in word 2000

5. attach a file (text or words or excel) when submitting an asp form

6. Word Table in Form Text Box

7. Text box control in Word form

8. spell check text box in word 2000 form

9. Word Table in Form Text Box

10. String truncates all but 1st word in Form Input type text box

11. Exposing Word in browser form text boxes

12. Use Word spellcheck on an Access text box

 

 
Powered by phpBB® Forum Software