This is a simple example of how to interact visual basic program to MS Word. Interactions that we discuss here is how to open a MS Word through a form that available on the visual basic program, transferring text from the form into a Word document.
The text you write in visual basic form can be transferred to a word document. The steps are as follows:
> Put a TextBox and a CommandButton on the form!Set the properties of each componen.
Command1.caption = Transfer
Text1.multiline = True
Open the code window, then paste the code below:
Private Sub Command1_Click()
Dim word
Set word = CreateObject("word.basic")
word.appshow
word.filenew
word.Insert Text1.Text
End Sub
Run the program or press F5. Type in any word, and then click the "Transfer" button.
![step-2](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIvcb8aXt6Uz2KsJprp9ltZvLmgI1emlzKCQWGGoTbNmSNgJJ1rF-PbpL0WGxfdDh9eeoabU7kb3LwyvkMV2HGcPME82obRI67jHJMMDLgefa4mkrnqAe_asankVs0vWsQCW9b56EYYtIc/s1600/form-interaction-to-ms-word.png)
After the "Transfer" button is clicked, the text will be displayed on a MS Word document.
![step-3](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzZ1WkuasibaguC2WoqztsidZHtEsbBc6bb3weIlam9t5T8MxkAAalzd9SM3OeWeLMd1RCiihYlPBhjYcFUJFyd84dnG22mlfIqKM5JSETRTM7q7FMiDm9SnjZWP2-mNRz7c42SWg_RMs8/s280/form-interaction-to-ms-word.png)
Hopefully these tips useful for you.
Keyword: Interaction with MS Word using Visual Basic | visual basic to MS Word