+ Reply to Thread
Results 1 to 8 of 8

Aggregate Batch Data from many word docs into an Excel (i.e.Check Boxes, Text Form Fields)

  1. #1
    Registered User
    Join Date
    04-03-2014
    Location
    Walnut Creek, CA
    MS-Off Ver
    2013
    Posts
    15

    Question Aggregate Batch Data from many word docs into an Excel (i.e.Check Boxes, Text Form Fields)

    Hey Guys,

    This one might be a bit of a bruiser but any help is appreciated.

    I have lots of word documents 75-100 that are a 3 page form that our staff completed and emailed to me. My job is to collect the forms from each of the staff and aggregate the data from each form that people filled out and put it all into a master 3-page form. The good news is each form is the same format, just the information checked and entered is specific to the individual that filled it out. My deadline is the end of the month, so at some point if I can't figure this one out, I am going to print and do it manually. I have always been of the opinion, if something has been entered electronically in an organized fashion, there MUST be a way to get it into excel.

    I was thinking, is there is some way to pull the data from each of the word documents (in this case, people are checking check boxes and entering names/free text into Text Form Fields) and drop it into an excel spreadsheet, it would make my life easier. If it's all in an excel document, I can calculate and sort much easier. The alternative is to print all 100 or so and tally by hand...such an ill-fated task awaits me in purgatory - Not to mention all the trees that will suffer.

    If the final spreadsheet, if each row is designated for each person that filled out the form then each column could be a "cell" from the table:
    - for the check boxes - enter cell value 1 for a check yes and 0 for check no
    - for the free text - enter the value that the person typed into the check box

    Attached, is a very simple arrangement of how most of the form looks - each cell in the table has content that I would like to separate by column


    Form Sample.docx

    On a tangent - is there some way in excel to reference (I don't know, V_Lookup?) a single "Cell" in a microsoft word document's table? At least it would save me re-typing everything. Is there some way to convert a bunch into csv files and upload to excel that way?
    Last edited by Chrisdudley7; 04-22-2014 at 01:22 PM.

  2. #2
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Aggregate Batch Data from many word docs into an Excel (i.e.Check Boxes, Text Form Fie

    The following Excel macro assumes your form uses Content Controls:
    Please Login or Register  to view this content.
    If your form uses formfields (you should not be using content controls and formfields in the same form), change:
    Dim CCtrl As Word.ContentControl
    to:
    Dim FmFld As Word.FormField

    Change:
    strFile = Dir(strFolder & "\*.docx", vbNormal)
    to:
    strFile = Dir(strFolder & "\*.doc", vbNormal)

    Change:
    For Each CCtrl In .ContentControls
    to:
    For Each FmFld In .FormFields

    Change:
    WkSht.Cells(i, j) = CCtrl.Range.Text
    to:
    WkSht.Cells(i, j) = FmFld.Result
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    Registered User
    Join Date
    04-03-2014
    Location
    Walnut Creek, CA
    MS-Off Ver
    2013
    Posts
    15

    Re: Aggregate Batch Data from many word docs into an Excel (i.e.Check Boxes, Text Form Fie

    What are Content Controls? The FormFields are what they type the free text into right? Are content controls where they select an option from many?

    I need some help with this - I don't do macros often. What aspects of the Macro do I need to change?

    1. I opened Visual Basic
    2. Inserted a new module
    3. Paste the information in
    4. what do I do to go from there?

  4. #4
    Registered User
    Join Date
    04-03-2014
    Location
    Walnut Creek, CA
    MS-Off Ver
    2013
    Posts
    15

    Re: Aggregate Batch Data from many word docs into an Excel (i.e.Check Boxes, Text Form Fie

    Word object model is a blank version of the form right? Where do I enter that into the Macro?

  5. #5
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Aggregate Batch Data from many word docs into an Excel (i.e.Check Boxes, Text Form Fie

    Quote Originally Posted by Chrisdudley7 View Post
    What are Content Controls? The FormFields are what they type the free text into right? Are content controls where they select an option from many?
    Content controls and formfields can both be used for inputting data, selecting from dropdown options, and checking checkboxes. Both are accessed via the Controls group on Word's Developer tab. The main ones you'll see there are the content controls; formfields are accessed via the 'Legacy Tools' icon. You need to understand what kind of forms you're working with before you'll be able to progress.
    I need some help with this - I don't do macros often. What aspects of the Macro do I need to change?
    If you're using content controls, you don't need to change anything. If you're using formfields, you'll need to make the changes indicated in my previous post.
    1. I opened Visual Basic
    2. Inserted a new module
    3. Paste the information in
    4. what do I do to go from there
    Did you do this in Excel?
    Word object model is a blank version of the form right?
    Wrong. It's a reference, set via Tools|References in the VBA IDE. You open that, scroll down to where the list refers to 'Microsoft Word 14.0 Object Library' and check that option.

    When you've done that it's just a matter of selecting the worksheet you want the data to appear on, then running the 'GetFormData' macro. The macro includes its own browser, so all you need do is use that to select the folder to process. All .docx files in that folder will be processed. If you use .doc files and not .docx, change the .docx reference in the code to .doc.

  6. #6
    Registered User
    Join Date
    04-03-2014
    Location
    Walnut Creek, CA
    MS-Off Ver
    2013
    Posts
    15

    Talking Re: Aggregate Batch Data from many word docs into an Excel (i.e.Check Boxes, Text Form Fie

    Cool, thanks for your help! once I fixed the 'Microsoft Word 14.0 Object Library', everything worked smoothly with the Content Controlled macro.

    For the formfields, I replaced in the formfield specific elements but did not have success - I have a question: Is this macro designed to pull form fields were there is a drop down menu of options to pick (e.g. Pick a color --> Blue Red Green)? When I run the macro, nothing spits out and I am wondering if it is because the form fields in this checklist are not the type that people select an answer from a finite list. These are free text form field where you can type in anything.

    I am attaching a picture of what the form fields look like on the form - people just left click in the grey (the it turns blue), and then they type in their custom text.

    formfields.jpg
    Last edited by Chrisdudley7; 04-23-2014 at 03:44 PM.

  7. #7
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Aggregate Batch Data from many word docs into an Excel (i.e.Check Boxes, Text Form Fie

    If you're using formfields and you make the code changes as indicated, the macro will pull in the data from every formfield in the body of the document (you can't put them in headers & footers anyway), be it a text formfield, a checkbox formfield or a dropdown formfield.

  8. #8
    Registered User
    Join Date
    04-03-2014
    Location
    Walnut Creek, CA
    MS-Off Ver
    2013
    Posts
    15

    Re: Aggregate Batch Data from many word docs into an Excel (i.e.Check Boxes, Text Form Fie

    Hey Thanks for your help, I got it to work on both Macro Counts - I ended up only being able to use the checkbox Macro as the FormField Macro worked perfectly only my participants that completed the survey did not double click and enter text into the FormField so I was not able to pull any info.

    It is worth noting in this thread, the macro pulls data from left to right then top to down. You will need to mark which columns are associated with the checkboxes otherwise it is just a sea of checkboxes that are not referencing anything in particular. Also, I found it useful to perform a find and replace to change the checked check boxes to 1's and the unchecked check boxes to 0's - this helps to quantify and aggregate the data.

    Good Stuff, thanks Macropod!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 06-27-2013, 07:43 PM
  2. Data from Word Form Fields in Excel Spreadsheet
    By birth19 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2012, 12:13 PM
  3. [SOLVED] How to Transfer data from Text Form Fields in MS Word into Excel?
    By CWillis in forum Excel General
    Replies: 1
    Last Post: 07-18-2006, 01:35 AM
  4. Replies: 3
    Last Post: 05-11-2006, 01:55 PM
  5. Replies: 0
    Last Post: 04-07-2005, 12:12 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1