pass variables to a Word document
Posted on 2004-10-14
I am writing a WinForms application in VB.Net.
Does anyone have some sample code for passing variables to a Word document? I have read a multitude of links that Experts have recommended in the past, but I would like just a quick sample code snippet to achieve the following.
I have a 'standard' letter, which does not change except for the Name and Address of the recipient, which I would like to "pass" to the Word document from my application. Of course I will also need to know what I need to type into the Word document in order for the application to recognise that this is where it must insert the variable being passed.
Some further issues:-
1. Do I need to enter eg. <<AddressLine1>> in the word document and then somehow detect and replace this from the application?
2. Do I simply use bookmarks in Word and then simply say in the application: something like At bookmark "bookmark1" insert txtAddressLine1.text (say).