Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Filling out a MS Word Template with VB6

Posted on 2004-04-22
3
Medium Priority
?
1,249 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
sbennetts earned 300 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
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…

721 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