Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-08-2016, 12:10 PM
lwbarnes lwbarnes is offline VBA Export Data as Text from Excel to Word Windows 7 32bit VBA Export Data as Text from Excel to Word Office 2010 32bit
Novice
VBA Export Data as Text from Excel to Word
 
Join Date: Jun 2016
Posts: 3
lwbarnes is on a distinguished road
Default VBA Export Data as Text from Excel to Word


Hi,

I am kind of new to VBA, especially Word. I was wondering if it would be possible to create a macro that could take a report from excel and insert that information directly into word? The information is numerical, dates, and words with some of the numerical information needing to be summed. The rows are also variable in that each subset has a different amount of rows associated with it (if that makes sense). I was also wondering if it would be possible to create a popup screen where I can type in the code that I am wanting so it will only populate that codes information into the word document. The word document is a report that doesn't change (it's a template), and I have already put bookmarks into the word document. Please let me know if this is possible or if more information is needed or if a sample would help!! This is a very manual process to copy and paste the information from excel to word, and would be helpful to have in my work place. Any help would be greatly appreciated!!

Thank you
Reply With Quote
  #2  
Old 06-08-2016, 02:37 PM
macropod's Avatar
macropod macropod is offline VBA Export Data as Text from Excel to Word Windows 7 64bit VBA Export Data as Text from Excel to Word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

What you're describing is a task usually performed via a mailmerge. No VBA required. See: https://support.office.com/en-us/art...D-E3C7D30C954A

As for the variable row count, you can use a Catalogue/Directory Mailmerge (the terminology depends on the Word version). To see how to do so with any mailmerge data source supported by Word, check out my Microsoft Word Catalogue/Directory Mailmerge Tutorial at:
http://windowssecrets.com/forums/sho...merge-Tutorial
or:
http://www.gmayor.com/Zips/Catalogue%20Mailmerge.zip
The tutorial covers everything from list creation to the insertion & calculation of values in multi-record tables in letters. Do read the tutorial before trying to use the mailmerge document included with it.

The field coding for this is complex. However, since the tutorial document includes working field codes for all of its examples, most of the hard work has already been done for you - you should be able to do little more than copy/paste the relevant field codes into your own mailmerge main document, substitute/insert your own field names and adjust the formatting to get the results you desire. For some worked examples, see the attachments to the posts at:
https://www.msofficeforums.com/mail-...html#post23345
https://www.msofficeforums.com/mail-...html#post30327
http://windowssecrets.com/forums/sho...l=1#post928391

Another option would be to use a DATABASE field in a normal ‘letter’ mailmerge main document and a macro to drive the process. An example of this approach can be found at: http://answers.microsoft.com/en-us/o...1-1996c14dca5d

Alternatively, you may want to try one of the Many-to-One Mail Merge add-ins, from:
Graham Mayor at http://www.gmayor.com/ManyToOne.htm; or
Doug Robbins at http://bit.ly/1hduSCB

In addition to a 'Many to One' merge, the latter handles:
• Merge with Charts
• Duplex Merge
• Merge with FormFields
• Merge with Attachments
• Merge to Individual Documents
• Merge, Print and Staple
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 06-09-2016, 07:11 AM
lwbarnes lwbarnes is offline VBA Export Data as Text from Excel to Word Windows 7 32bit VBA Export Data as Text from Excel to Word Office 2010 32bit
Novice
VBA Export Data as Text from Excel to Word
 
Join Date: Jun 2016
Posts: 3
lwbarnes is on a distinguished road
Default

Would it be possible for me to send you what I am working with so you can see what I need to do?
Reply With Quote
  #4  
Old 06-09-2016, 02:47 PM
macropod's Avatar
macropod macropod is offline VBA Export Data as Text from Excel to Word Windows 7 64bit VBA Export Data as Text from Excel to Word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You can attach a document to a post via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Export Data as Text from Excel to Word Export Word Form Data to Access pboland Word VBA 1 06-12-2015 06:53 PM
VBA Export Data as Text from Excel to Word Export data from C# winForms treeView to MS-Word MergeFields nisim651 Mail Merge 8 04-18-2014 04:17 AM
VBA Export Data as Text from Excel to Word Baseline1 estimated finish - export to excel - data disconnect. - MSProject 2010 SP1 stct Project 1 04-23-2013 05:11 AM
VBA Export Data as Text from Excel to Word Handle Text / Numeric values in SSRS while Export To Excel achuki Excel 5 02-07-2012 02:14 PM
Export data from multiple attachments into a single excel document Woolstar Outlook 0 12-07-2011 09:49 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:45 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft