VBA – Transfer data from Excel to Word

With the current article I will show you how to transfer data from Excel to Word. I will use Office 2010 and windows 7.



In the first code snippet, I declare 2 objects and a range. The first Object is the Word Application object (oWord) and the second one is the document itself. As far as the code is ran from an Excel file, no object for the file is needed. The copied used range is simply pasted in the word file. Here is the code:

In the second snippet, I will do the same, but I will use the function Selection.TypeText, in which one may type whatever he wants. With this function, I will write the name of the Excel file and the current date.

This is done with the following:

The whole code goes here:


Enjoy it!