Solved

Filling out a MS Word Template with VB6

Posted on 2004-04-22
3
1,242 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Paint/Redraw window while dragging 16 82
clicking a shape in a frame array vb6 3 46
MS Access 03, TransferText, decimal places 8 78
VBA - If Bookmark = "XXBOOKMARKXX" then 15 40
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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

809 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