Consulting

Results 1 to 6 of 6

Thread: Button on Word form to transfer Data to Excel

  1. #1
    VBAX Newbie
    Joined
    Aug 2014
    Posts
    3
    Location

    Button on Word form to transfer Data to Excel

    OK. I'm working with several people that don't normally use computers. I'm creating a form in Word 2013 for them. I need several buttons at the bottom of the form for them to use. The first button is a simple "Print Form" function. It will automatically send the form to the printer with a specified input tray. The second button is a "Save & Create New" button. It will transfer the data in the form to Excel and then clear the form. The third and final button is a "Save & Exit" button. It will transfer the data in the form to Excel and exit Word.

    The form has places where they are picking dates, places where they are choosing from a drop down box, text boxes and check boxes. Any help on this would be AMAZING!

    MANY MANY thanks!!!!

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Trying to push data from Word to Excel is a bad idea IMHO. The main reason is that it will fail if someone else has the Excel workbook open. It is far better, therefore, to pull the Word data into Excel. For some code to get you started on that, see:
    http://www.vbaexpress.com/forum/show...l=1#post257696
    Although the code there is designed for use with ContentControls, post #14 in the same thread shows the adaptations needed to work with formfields. As coded, the macro there pulls in the data from all word documents in the source folder. If you're only wanting to add data, not start over from scratch, you'd need to either:
    a) temporarily put just the documents you want to process into an 'extraction' folder; or
    b) modify the code to exclude documents that have already been processed.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    VBAX Newbie
    Joined
    Aug 2014
    Posts
    3
    Location
    Would it be easier to just create the form in Excel and have it save the information to another workbook or another worksheet in the same workbook? What I'm concerned about is that the people that would be using this form are not really knowledgeable with computers at all. I'm afraid that if I ask them to open Word, fill out the form, and then go into Excel and click the macro button that data will get lost. They may forget or not do it at all. I need to make this as simple as possible for them until we can get the SQL database with Access forms that I'm creating up and running.

    THANK YOU!!!
    Tammy

  4. #4
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Is there a particular reason you need the Excel workbook updated whenever the user decides? What about if they do it two or more times for the same document - perhaps because they made a mistake to first time or because they forgot they'd already done it? Doing everything from within Excel doesn't make handling these issues any simpler. It's much easier, though, if the users work in the Word documents and whoever needs to collect the data does that as an independent exercise.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  5. #5
    VBAX Newbie
    Joined
    Aug 2014
    Posts
    3
    Location
    I would like this form to be a template that they can use over and over, either over a course of several days or in one sitting. I work for a landscape company and this form is used for customer requests, one request per form......The people using the form are not well versed in using a computer so the simpler for them the better.

    Would it just be easier for them to save the template in one folder under each document number (because each form is being auto numbered) or customer name & number (since the customer normally has more than 1 request) and then I just copy the information from each file to Excel? Once we print a copy of the form there is no need to keep an electronic version of the form but I need the data for reports that their boss, the operations VP and the owner of the company are looking at. The printed copy goes to the crew to complete the task and then returned to the account manager for them to bill so I don't see the information even though I need the info.

    Many Thanks!
    Tammy

  6. #6
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    Creating a Word template for your staff to use is entirely unrelated to transferring the data to Excel. There is no need for the staff to be involved in the latter and, as I've already said, there are potentially significant problems with this. There also seems to be a problem in your understanding of what a template is. In Word, a template is a file with .dot(m/x) extension from which documents are created. They are not documents that people open, modify and save copies of. That is fraught with danger - such as the original being overwritten. So, to log a customer order, the user would use File|New> choose the appropriate template. Word will then create a new document which the staff can complete and save.

    Later on, when you want to extract the data, simply open the Excel workbook and run the macro.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

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