Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1254
  • Last Modified:

Filling out a MS Word Template with VB6

I have a Word Template that contains several textboxes on it (txt_Name, txt_Birthdate, etc.).  I want VB to open the template and fill in the textboxes with values from my program.  I got the template open but I am stuck on how to change the text of the textboxes.  Thanks in advance for the help.
0
jmwheeler
Asked:
jmwheeler
  • 2
1 Solution
 
sbennettsCommented:
You could insert bookmarks into each of the text boxes and then use the following code to enter the data at the correct location...

oApp.Documents.Open myFileName, , True
oApp.Visible = False
'Find the 'bookmark' and add mytext
oApp.Documents(1).Bookmarks(myBookMarkName).Select
oApp.Selection.TypeText myText

Simon
0
 
jmwheelerAuthor Commented:
This might work, does anyone have a solution that would allow me to do this without adding a bunch of bookmarks?
0
 
sbennettsCommented:
You can use the
oApp.Documents(1).fields property, but I'm not 100% sure of the syntax involved...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now