Automating Word (need some help.)

I'm struggling with the following:

I'm using VB.NET and I want to make a program that put some text from a textbox at a certain place in a Word document.

So I used the following code to start Word with a new document and a bookmark were I want to have the text from the textbox:

Dim wordapp As Word.Application
Dim letter As Word.Document

wordapp = CType(CreateObject("Word.Application"),_
brief = CType(wordapp.Documents.Add, Word.Document)
brief.Application.Visible = True
I have two questions:

1)First of all this code creates a NEW word document, BUT I want to use an existing Word document(with already some text and pictures in it).

2)I don't know how to put the text from the textbox at the place of the bookmark!

I'm very new to this, so I would appreciate it you can give my the correct code for this, not only some hints.

Hope someone can help me!


VB Newbie
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!