Sunday, April 17, 2016

How to create MS Word document automatically by inserting text file content to the word document

There are many situations you may want automate the MS Word document creation. In my previous posts I have explained how to automate document generation using VBA.

How to create a template in MS Word

Now, I will explain how to insert a text file into document as is at a specified location in the document. First step is to create bookmark in word document where the text file content will be pasted. Then, open the text file using VBA code and paste the content at the bookmark. Save the file as with different name. Before saving optionally you can remove the bookmark.

Below video shows shows details steps to insert a text file into MS word document