Solved

Filling out a MS Word Template with VB6

Posted on 2004-04-22
3
1,234 Views
Last Modified: 2008-03-03
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
Comment
Question by:jmwheeler
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
sbennetts earned 100 total points
ID: 10889316
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
 
LVL 11

Author Comment

by:jmwheeler
ID: 10889389
This might work, does anyone have a solution that would allow me to do this without adding a bunch of bookmarks?
0
 
LVL 2

Expert Comment

by:sbennetts
ID: 10889494
You can use the
oApp.Documents(1).fields property, but I'm not 100% sure of the syntax involved...
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now