Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1251
  • 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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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