Trying to Create a Macro...it's not going well

Hello! 
I am trying to create a macro for this Questionnaire I am building. I need it to pull information from 3 or so different tables in word (all in same doc) and export them into Excel. I have fields that gather personal info like Name, Address, Telephone Number,
Email, etc, but also fields that take info like Tax Filing State and Tax ID number. There will be about 40 fields in all when the questionnaire is done. Each field is being filled in using a legacy tool- text form field. Is there some sort of macro shell I
can use that I can fill in with each field when I have completed it? I have office 2013, not sure if that matters.
Thank you!

The following Excel macro will pull the data from all formfields in all Word files in a specified folder into the active worksheet. To run it, simply press Alt-F8 and choose the 'GetFormData' macro. You'll be asked to navigate to the source folder.
Once you've done that, the macro will populate the worksheet. The first row will be left alone, so you can populate it with headings before or after running the macro.
Sub GetFormData()
     'Note: this code requires a reference to the Word object model
    Application.ScreenUpdating = False
    Dim wdApp As New Word.Application
    Dim wdDoc As Word.Document
    'Dim CCtrl As Word.ContentControl
    Dim FmFld As Word.FormField
    Dim strFolder As String, strFile As String
    Dim WkSht As Worksheet, i As Long, j As Long
    strFolder = GetFolder
    If strFolder = "" Then Exit Sub
    Set WkSht = ActiveSheet
    i = WkSht.Cells(WkSht.Rows.Count, 1).End(xlUp).Row
    strFile = Dir(strFolder & "\*.doc", vbNormal)
    While strFile <> ""
        i = i + 1
        Set wdDoc = wdApp.Documents.Open(Filename:=strFolder & "\" & strFile, AddToRecentFiles:=False, Visible:=False)
        With wdDoc
            j = 0
            'For Each CCtrl In .ContentControls
                'j = j + 1
                'WkSht.Cells(i, j) = CCtrl.Range.Text
            'Next
            For Each FmFld In .FormFields
                j = j + 1
                WkSht.Cells(i, j) = FmFld.Result
            Next
        End With
        wdDoc.Close SaveChanges:=False
        strFile = Dir()
    Wend
    wdApp.Quit
    Set wdDoc = Nothing: Set wdApp = Nothing: Set WkSht = Nothing
    Application.ScreenUpdating = True
End Sub
Function GetFolder() As String
    Dim oFolder As Object
    GetFolder = ""
    Set oFolder = CreateObject("Shell.Application").BrowseForFolder(0, "Choose a folder", 0)
    If (Not oFolder Is Nothing) Then GetFolder = oFolder.Items.Item.Path
    Set oFolder = Nothing
End Function
Note the commented-out code that allows the macro to work with content controls as well or instead.
Cheers
Paul Edstein
[MS MVP - Word]

Similar Messages

  • I get this error when trying to create a ringtone - iTunes could not connec

    I get this error when trying to create a ringtone:
    "iTunes could not connect to the iTunes Store - an unknown error occurred (11556)"
    But I CAN connect - if I click on the iTunes Store, it connects right away.
    I want to make a ringtone from a song that I purchased, but all I get is the same error message.
    iTunes 9.2.2, Ireland iTunes Store.

    have you seen this KB article: http://support.apple.com/kb/HT1398 ?
    JGG

  • I am trying to create my Apple ID, but not receiving the verification link from Apple,. I get the email but NOT the link,. any suggestions

    I am trying to create my Apple ID, but not receiving the verification link from Apple,. I get the email but NOT the link,. I have triple checked my email address and all Apple account info, all of which are correct. Any suggestions?

    Where are you trying to create it?
    Go to appleid.apple.com and create it there.   Type the country name in the space and a dropdown should appear. Nigeria is clearly available there.

  • Pop-up menue created by Fireworks 8 does not work well in Dreamweaver 8

    Hi there,
    I have experienced some strange behaviour of Dreamweaver 8
    with respect to am enuebar with pop-up-Menue-HTML created by
    Fireworks 8. Having designed the pop-up menue in Fireworks 8 all
    works fine if you view it through Firewoks. After having exported
    the XHTML-Code for Dreamweaver in a file all continues to work fine
    if you view it with IE 7.
    When imported to Dreamweaver as Fireworks-HTML blue boxes
    were shown around the bar and the pop-menue appears with blue boxes
    around. Viewing this stuff by pressing F12 in Dreamweaver shows up
    the page in the browser with the menue bar and all the submenues (I
    cant stand it anymore). I tried a lot of things but I failed. Help
    would be appreciated very much.
    Wolfgang

    Have a read of this article - may convince you why it's not a
    good idea to
    use these menus:
    http://www.losingfight.com/blog/2006/08/11/the-sordid-tale-of-mm_menufw_menujs/
    also:
    http://apptools.com/rants/jsmenu.php
    http://apptools.com/rants/menus.php
    Nadia
    Adobe® Community Expert : Dreamweaver
    CSS Templates |Tutorials |SEO Articles
    http://www.DreamweaverResources.com
    http://www.csstemplates.com.au
    http://www.perrelink.com.au
    CSS Tutorials for Dreamweaver
    http://www.adobe.com/devnet/dreamweaver/css.html
    "wogtube" <[email protected]> wrote in
    message
    news:epnmsl$t16$[email protected]..
    > Hi there,
    >
    > I have experienced some strange behaviour of Dreamweaver
    8 with respect to
    > am
    > enuebar with pop-up-Menue-HTML created by Fireworks 8.
    Having designed the
    > pop-up menue in Fireworks 8 all works fine if you view
    it through
    > Firewoks.
    > After having exported the XHTML-Code for Dreamweaver in
    a file all
    > continues to
    > work fine if you view it with IE 7.
    >
    > When imported to Dreamweaver as Fireworks-HTML blue
    boxes were shown
    > around
    > the bar and the pop-menue appears with blue boxes
    around. Viewing this
    > stuff
    > by pressing F12 in Dreamweaver shows up the page in the
    browser with the
    > menue
    > bar and all the submenues (I cant stand it anymore). I
    tried a lot of
    > things
    > but I failed. Help would be appreciated very much.
    >
    > Wolfgang
    >

  • Need help with creating template. Changes are not going through to index.html page

    Hi all,
    I have an issue with my template that I am creating and also a question about creating template Regions (Repeating and Editable).
    Somehow my changes to my index.dwt are not changing my index.html page.
    Also my other question is: For my top navigation bar and left navigation bar links, do I need to select and define each individual button or link as Repeating/Editable Region? or can I just select the whole navigation bar (the one on the top) etc...
    Below are my steps for creating my template...I am kinda fairly new to using DW and this is my first attempt to making a template following the DW tutorial CD that came with DW CS3.
    I appreciate any help with this...regards, Dano
    -Open my index.html file
    -File/save as template
    -Save
    -update links - yes
    -Select Repeating and Editable Regions (I selected the whole top navigation bar and selected Repeating Region and Editable Region, same with the left side navigation links)
    -File close all
    -Open the index.dwt
    -Save as and selected the index.html and chose to overide it..
    When I make changes to my index.dwt it is not changing the index.html
    I feel that I am missing some important steps here.....
    Website address
    www.defenseproshop.com

    Figured out

  • Hi am trying to update my ipad but is not going true

    want to update my ipad but i cant do so why,its telling me network error

    Try disabling your firewall and antivirus software and then try to update again.

  • Upgrade IDSM2 from 4.1(5)S225 to 5.0 not going well

    UPGRADING FROM 4.1 to 5.1. I know I have to got to 5.0 before I go to 5.1
    I have tried to upgrade from 4.1 to 5.0 and am failing. I upgraded the Maintenance Partition to 2.1(2) as you can see from the show ver command output.
    When I go to upgrade using the file IPS-K9-maj-5.0-1-S149.rpm.pkg i get the error messages to the console. they are included in the command line dump that follows..........
    Cisco Systems Intrusion Detection Sensor, Version 4.1(5)S225
    OS Version 2.4.18-5-phoenix
    Platform: WS-SVC-IDSM2-BUN
    Using 970657792 out of 1979682816 bytes of available memory (49% usage)
    Using 5.1G out of 17G bytes of available disk space (32% usage)
    MainApp 2005_Sep_01_21.30 (Release) 2005-09-01T21:30:35-0500 Running
    AnalysisEngine 2005_Sep_01_21.30 (Release) 2005-09-01T21:30:35-0500 Running
    Authentication 2005_Sep_01_21.30 (Release) 2005-09-01T21:30:35-0500 Running
    Logger 2005_Sep_01_21.30 (Release) 2005-09-01T21:30:35-0500 Running
    NetworkAccess 2005_Sep_01_21.30 (Release) 2005-09-01T21:30:35-0500 Running
    TransactionSource 2005_Sep_01_21.30 (Release) 2005-09-01T21:30:35-0500 Running
    WebServer 2005_Sep_01_21.30 (Release) 2005-09-01T21:30:35-0500 Running
    CLI 2005_Aug_02_10.53 (Release) 2005-08-02T10:25:35-0500
    Upgrade History:
    IDS-sig-4.1-5-S225.rpm.pkg 14:40:27 UTC Thu Apr 20 2006
    Maintenance Partition Version 2.1(2)
    THESE ARE THE ERROS I AM GETTING DURING THE UPGRADE WHICH FAILES.
    /signatures/[sig-id=11027,subsig-id=0]/engine/ -- the union does not have a member selected
    /signatures/[sig-id=11211,subsig-id=1]/engine/ -- the union does not have a member selected
    /signatures/[sig-id=11245,subsig-id=0]/engine/ -- the union does not have a member selected
    /signatures/[sig-id=11245,subsig-id=1]/engine/ -- the union does not have a member selected
    /signatures/[sig-id=11246,subsig-id=0]/engine/ -- the union does not have a member selected
    /signatures/[sig-id=11247,subsig-id=0]/engine/ -- the union does not have a member selected
    /signatures/[sig-id=11248,subsig-id=0]/engine/ -- the union does not have a member selected
    /signatures/[sig-id=11249,subsig-id=0]/engine/ -- the union does not have a member selected
    /signatures/[sig-id=11250,subsig-id=0]/engine/ -- the union does not have a member selected
    /signatures/[sig-id=11251,subsig-id=0]/engine/ -- the union does not have a member selected
    /signatures/[sig-id=12024,subsig-id=0]/engine/ -- the union does not have a member selected
    /signatures/[sig-id=12025,subsig-id=0]/engine/ -- the union does not have a member selected
    /signatures/[sig-id=12025,subsig-id=1]/engine/ -- the union does not have a member selected
    /signatures/[sig-id=12026,subsig-id=0]/engine/ -- the union does not have a member selected
    /signatures/[sig-id=12027,subsig-id=0]/engine/ -- the union does not have a member selected
    Any help would be great!
    gary price

    The combination of tcp-reset on some UDP signatures in 4.x. was not invalidated. 5.0 is stricter and enforces this. It might be the best to disable reset for all signatures and then proceed with the upgrade.

  • Galaxy Nexus - online upgrade not going well

    I tried to order the Galaxy Nexus through the Verizon online site.  Two problems:  First, the system will not give me the NE2 discount.  Second, I have an unlimited data plan on my existing phone and site wants me to change to another one.   I'm going to order by phone but I prefer online as I can type in specific address information and verify the terms in writing.

    I'm clearly eligible for the NE2 since it's only been three months since the regular upgrade time.  And the VZW web page has an indicator that shows that this particular line is eligible for the loyalty discount. 
    But when browsing through the list of phones, the prices of some recent models, such as the RAZR and Galaxy Nexus, do not reflect the loyalty discount.  Most others, such as the iPhones, clearly list the discount and show it subtracted from the normal price.  Note that the Galaxy Nexus price does not have the NE2 already embedded in it.  The Galaxy Nexus has the same price on my NE2-eligible account as on my other lines that are upgrade eligible but not NE-2 eligible.  And the NE2 adjustment does not get taken off later in the order process. 

  • Synching Not Going Well - Still

    Unlike almost everyone else, the only thing I've been able to get to sync reliably since last Friday has been my Address Book. I've had ongoing problems with iCal - haven't even tried Bookmarks yet, but that's mostly because I've got a bookmark mess on my two computers. When I last tried to synch either of my computers with MobileMe, I got error messages that said there was a server error with no further word except that the synch didn't work.
    As I understand the issue with calendar synching, it seems to work IF: none of your calendars contains any recurring events, AND none of the calendars is an external one to which you have subscribed.
    As it stands, I have 40 calendars in iCal, about half of which are subscription calendars, among them Apple's own Birthdays calendar from Address Book. In addition, I have tons of recurring events in calendars that I have created.
    I know that calendar synching works - I created a dummy account and put in a couple of dummy events in iCal in that account's Home calendar. It synched up to MobileMe just fine, as did some events I entered in the calendar in MobileMe synch back to the computer. So am I going to be stuck dumping all my baseball and other sports schedules and hand-copying my recurring events from one date to the next? Yikes!!! Say it isn't so!!!!

    I forgot to mention that this happens with both boot cdrom and boot cdrom -s

  • Upgrade to Tiger not going well ....

    A great big pre-thank-you to any who may respond to this post.
    I am trying to upgrade from 10.3 (It was 10.3.? but I have since re-installed the 10.3 os in order to start at a working baseline) to 10.4. I have the black disk with the silver X. I am installing from an external Plextor DVD Drive (firewire). I have had the same error in the log since I started this wacky ride.
    BomFileError 2 : No such file or directory -./System/Library/Frameworks/AddressBook.framework/Versions/A/AddressBook
    This is the final entry in the log every time the upgrade/install fails.
    Here are the fixes I've tried already.
    -Doublecheck firmware updates
    -Download/install Combo Update (not the security updates or any of the iBook, iPod, iTunes, iEct. updates)
    -Install with erase hard drive.
    -Re-Install with earase HD of 10.3
    -Verify/Repair permissions and disk (the disk had no errors)
    There may have been a few other fixes I've tried but those are the major ones.
    Any help would be appriciated as I seem to be at a dead end.
    At least it's a work comp, so I'm getting paid.

    There are no guarantees, but following this procedure when installing updates and upgrades on your Mac will go a long way towards avoiding unpleasant after effects and ‘post-update stress disorder’.
    It is also worth noting that it is an extreme rarity for updates to cause upsets to your system, but they may well reveal pre-existing ones, particularly those of which you may have been unaware. If you are actually aware of any glitches, make sure they are fixed before proceeding further.
    So before you do anything else:
    If you can, make a full backup first.
    Turn off sleep mode for both screen and hard disk.
    Disconnect all peripherals except your keyboard and mouse.
    1. Repair Permissions (in Disk Utility)
    2. Verify the state of your hard disk using Disk Utility. If any faults are reported, restart from your install disk (holding down the C key), go to Disk Utility, and repair your startup disk. Restart again to get back to your startup disk.
    At least you can now be reasonably certain that your system does not contain any obvious faults that might cause an update/upgrade to fail.
    3. Download the correct version of the COMBO update from the Apple download site. If your car runs on gasoline you would not want to fill the tank with diesel, so don’t try to install the PPC updater on an Intel Mac!
    If you prefer to download updates via Software Update in the Apple menu (which would ensure that the correct version for your Mac was being downloaded), it is not recommended to allow SU to install major (or even minor) updates automatically. Set Software Update to just download the updater without immediately installing it. There is always the possibility that the combined download and install (which can be a lengthy process) might be interrupted by a power outage or your cat walking across the keyboard, and an interrupted install will almost certainly cause havoc. Once it is downloaded, you can install at a time that suits you. You should make a backup copy of the updater on a CD in case you ever need a reinstall.
    Using the Combo updater ensures that all system files changed since the original 10.4.0 are included, and any that may have been missed out or subsequently damaged will be repaired. The Delta updater, although a temptingly smaller download, only takes you from the previous version to the new one, i.e. for example from 10.4.9 to 10.4.10. Software Update will generally download the Delta updater only. The preferable Combo updater needs to be downloaded from Apple's download site.
    Now proceed as follows:
    4. Close all applications.
    5. Unplug all peripherals except your keyboard and mouse.
    6. Install the update/upgrade. Do not under any circumstances interrupt this procedure. Do not do anything else on your computer while it is installing. Be patient.
    7. When it ask for a restart to complete the installation, click restart. This can take longer than normal, there are probably thousands of files to overwrite and place in the correct location. Do nothing while this is going on.
    8. Once your Mac is awake, repair permissions again, and you should be good to go!
    If your Mac seems slightly sluggish or ‘different’, perform a second restart. It can’t hurt and is sometimes efficacious!
    9. Open a few of your most used applications and check that all is OK. In this connection please remember that not all manufacturers of third party applications and plug-ins, add-ons, haxies etc, will have had time to do any necessary rewrites to their software to make them 10.4.10. compliant. Give them a weeks or two while you regularly check their websites for updates. This applies particularly to plug-ins for Safari 3.
    N.B. Do not attempt to install two different updates at the same time as each may have different routines and requirements. Follow the above recommendations for each update in turn.
    Lastly, Apple's own article on the subject of Software Update may also be useful reading:
    http://docs.info.apple.com/article.html?artnum=106695
    If you are updating Safari (or just have):
    Input Managers from third parties can do as much harm as good. They use a security loophole to reach right into your applications' code and change that code as the application starts up. If you have installed 10.4.11 and Safari is crashing, the very first thing to do is clear out your InputManagers folders (both in your own Library and in the top-level /Library), log out and log back in, and try again.
    So, disable all third party add-ons before updating Safari, as they may not have been updated yet for the new version. Add them back one by one. If something goes awry, remove it again and check on the software manufacturer's website for news of an update to match your version of Safari. Remember: Tiger up to 10.4.10 used Safari 2.0.4 or, if you downloaded it, Safari 3.0.3 beta. Safari 10.4.11 uses Safari 3.0.4 which is not a beta. If Safari 3.0.4 on 10.4.11 is not the fastest browser you have ever used, then something is wrong!
    Moreover, trying to revert to Safari 2 when running 10.4.11 can have repercussions, as Safari 3.0.4 uses a completely different webkit on which other applications like iChat, Mail and Dashboard Widgets etc also rely.
    Most errors reported here after an update are due to an unrepaired or undetected inherent fault in the system, and/or a third party ad-on. Two such add-on that have been frequently mentioned here for causing such problems are Piclens and Pithhelmet. If you have them, trash them.
    Additional tips on software installation here:
    http://docs.info.apple.com/article.html?artnum=106692

  • PB AL 15 to MBP C2D not going well

    Tried using Migration Assistant but old PB G4 Al 15" 1.33Ghz always froze as Target Disk on any transfer over 5GB (all that mattered). So moved stuff manually, so no big wonder I'm hosed now.
    Please spare me the "wipe it and start over" stuff, installing all the apps & pwd's from scratch will be last resort only, and I manage >60 G4 & G5 Macs at work that will soon migrate to Intel so I need to know how to fix things.
    So new MBP 15.4" 2.33Ghz is fine except for:
    1. MBP goes online fine at work (web, POP mail, whatever) but typing 1 character into any text field like Google or banks or anything freezes Safari instantly with BBOD. Firefox is fine. Unable to re-install any Java software update or 10.4.8 combo update
    2. At home old PB & MBP will connect to Belkin FD7230-4 wire & 802.11g gateway router fine (wireless or wired), can ARD & fileshare fine between them, Network pref's show "connected to network 'xyzap'. ..connected to Internet via Airport (or Ethernet, or both)" but the new MBP can only get RSS feeds (with Safari but NOTHING with Firefox, web sites get "ur not connected 2 internet" [Safari] and "Server not found" [Firefox] nor POP mail for that matter, haven't tried FTP yet..)
    x. Why does Migration Assistant fail with target locking up? Tried DU & DW repairs, no luck. On manual moves there were a few files that would kill transfers with "can't read or write" type errors, moving them separately by themselves or deleting got past that.
    *** does this tell us? Need some help here.
    Thx, dh

    Not much attitude about m&a (migration assistant?), but about these forums, I never get any help here.
    On about the 5th wipe and install try used ma after install instead of during (not the 1st time trying that way) and it left a log file on desktop (never did b4) which pointed to the mail.app files that were the culprits, deleted them, wiped & installed again and success moving 1 home directory.
    That said it seems clear from posts elsewhere that there are issues with "can't read or write" issues. The G4 PB had no problem with the files in question.
    And as to internet connections, also obvious from posts elswhere that there r issues with MBP C2D's and wireless gateway routers (NetGear, Linksys, D-link & Belkin (I have Belkin F5D7230-4US8.01.07, what a POS, worked with a couple all day at work trying to set up WDS / bridging, when their "tech support" hung up on me in 1st 5 seconds with 2nd level guy I threw 'em back to wally world). Dug a bit deeper tonight, plugged the MBP straight into cox cable modem again, no luck again UNTIL reboot cable modem then joy.
    So reran AirPortUpdate2006002.dmg but no joy. kaka. So anyway gonna mark this 1 done and post over at "Getting Online & Networking" to see if the help there is any better.
    peace, -d

  • Out on Safari and not going well

    Hello All,
    I wonder if you can help me. I am using Safari on Windows to view my Mobile Me calendars. However when I go to print the calendar all I get is a blank page. Is there anything I can do to print out the calendar?
    Cheers
    nick

    If I were you I would just not use Safari for this one time until a new update of the application is released. Just use firefox or internet explorer for the task at hand. But remember, when the next Safari for windows comes out download it immediately and use it from there on.
    -Amazing Man

  • Iphoto rebuild not going well...

    Hi there,
    I made the mistake awhile ago of reorganizing my photos on my HD, thus disconnecting them all from iphoto. I posted on there then, and got directions on how to rebuild my iphoto library (since there was no way to figure out where everything had been before I messed with it). I have iphoto 6, btw.
    I have my iphoto library folder on my desktop, as well as a stack of CDs they are backed up on. When I try to import from either, it lists all the files as unreadable or not containing valid data. My photos are in both places, at least that I can open up in preview or on other computers (with the CDs). I am not sure if I've corrupted iphoto or what, as it does not seem happy with me.
    Any advice would be great, you guys are very helpful. Thanks!

    Try dragging the folders of Originals from these Folders/ CD's to a new folder on the desktop first - gather them all in one place. Then import them.
    Regards
    TD

  • HT1923 Itunes 11.1.3 update crashed, uninstall not going well.

    Itunes uninstall wont proceed as Apple Mobile Device wont uninstall in windows 7, downloaded Revo but it doesnt see it on program list but windows does but cant seem to remove, does apple have an uninstaller?

    thanks, it was good advice
    I used Fix It and it locked the computer!!,
    I had to shut it down after 30 min of waiting with no cursor
    but when I restarted it Apple Mobile Device Manager was gone!
    I then followed a few more hints from others Tu Touring (sic)  on deletions 
    uninstalled Icloud
    mobile me 
    C:\common files- apple
    (I checked on Task Manager for anything on)
    I then re-installed Itunes 11.1.4 and it appears working
    I will reinstall anything else that doesnt auto install
    Now jaded on Apple software updates,
    they cost lots of time to fix (it was like a virus) and I have lost confidence in their product
    but again thank you apple community for the help

  • HT201177 I am trying to create home movies and each time there is no sound when I play back the disc. The sound is there when I play back in imovie and also after I've shared with idvd and played back. Not sure what else to do???

    I am trying to create home movies, and do not have sound on the final disc. The sound is there in imovie and after sharing to idvd. This has only happened a couple of times before and I have made a lot of movies. I have just gone through about 8 discs, all with no audio when I play them!!!

    You need to ask for support in the iMovie forum.

Maybe you are looking for

  • LR5.5 Cannot rate individual images in grid view

    Here's the problem I'm having on LR5.5 on Mac 10.8.5: In grid view, I select a range of images and hit "N" to go into Survey mode. When I highlight a single image and type a 1-4 rating it assigns that rating to every image selected in the survey. Eve

  • Storing password in property file

    i have an application which needs to read some values from property file but one problem is i need to store the password there as well. storing password as a plaintext is not acceptable for this case. is there any suggestion how to do it? and ofcours

  • Unable to update IOS 4.3.2 from IOS 4.3

    Unable to update IPhone 4 version 4.3 to version 4.3.2 from itunes. When I'm plug IPhone to PC, ITunes notification me whether want to update software. I clicked 'Download and Update' option and it take 1~2 hours to download but when downloaded finis

  • PlayBook Power Charger

    After three months, the Charger that came with my playbook stopped charging.  I can use a different device and it works fine, ie the usb cable to my PC. Has anyone else had the charger fail?  What was your course of action?

  • Servlet Responses without a Content-Type

    Hi, <p> Is it possible to configure OC4J running in a full iAS install not to set a default Content-Type header if the servlet code does not set one? <p> e.g. Using code such as: public class MyServlet extends HttpServlet     public void doGet(HttpSe