#1
|
|||
|
|||
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 |
#2
|
||||
|
||||
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] |
#3
|
|||
|
|||
Would it be possible for me to send you what I am working with so you can see what I need to do?
|
#4
|
||||
|
||||
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] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Export Word Form Data to Access | pboland | Word VBA | 1 | 06-12-2015 06:53 PM |
Export data from C# winForms treeView to MS-Word MergeFields | nisim651 | Mail Merge | 8 | 04-18-2014 04:17 AM |
Baseline1 estimated finish - export to excel - data disconnect. - MSProject 2010 SP1 | stct | Project | 1 | 04-23-2013 05:11 AM |
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 |