PDA

View Full Version : copy multiple ranges from Excel to tables in Word with VBA



nito
07-25-2017, 11:41 PM
Hi everybody, I have been trying for sometime now, to copy multiple ranges from Excel to tables in Word with VBA but still without succes...

I have a Excel document that i use to generate text to use as test documents, to every item i want to test i do a automated search with VBA for the template(in my excel workbook) that i use and add it's specifications.

That goes perfect, and i have been using it for a long time.

I would use the text/documents in Word with a specific layout, every time i have to copy everything from Excel to Word and print it...
Can any of you help me to do this with VBA?

Here is the file i use:
19875

...and here is what every range of text between the words "START" and "END" should look like in Word:
19876

macropod
07-26-2017, 06:56 PM
I got a warning when I opened your file about enabling it potentially harming my computer, so that's as far as I went.

If you're always using the same Excel range for the linking, you could simply use copy/paste with the 'paste link' option in Word and a suitable paste format to automatically replicate the data. No macros needed. If you do this using a Word template, then break the links immediately a new document is created (e.g. via Ctrl-A, Ctrl-Shift-F9), each new document will retain a permanent copy of the data at that time.

nito
07-27-2017, 12:24 AM
I got a warning when I opened your file about enabling it potentially harming my computer, so that's as far as I went.

If you're always using the same Excel range for the linking, you could simply use copy/paste with the 'paste link' option in Word and a suitable paste format to automatically replicate the data. No macros needed. If you do this using a Word template, then break the links immediately a new document is created (e.g. via Ctrl-A, Ctrl-Shift-F9), each new document will retain a permanent copy of the data at that time.

Sorry, I didn't see the warning, but it's probably because i edited the file yesterday on my Mac. But here is the complete file:
19893

I use the Sheet "Tags" to fill wat tags i want to convert into testing documents, every tag has it's document "typical", and that i define in the Column "Typical".
When i run the VBA code it inserts the tagnames into the typicals(templates in sheet UDT) and copys them to sheet "Testen".
What i need is the Templates/typicals/tables or what you want to call it to be exported to a word template that i have created with the company layout so i can print them and use as test documents when testing them with the client.

Hope i explained enough, because my english is not always as good as i would like...:doh: