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
Solved

VBA form in a Word template

Posted on 2003-11-06
3
385 Views
Last Modified: 2010-05-03
Hi,

I have become very frustrated with the following problem, so I'd be very grateful for any suggestions.

I have a word template, which contains a text field (say "txtName").  I also have a form, which contains a text box (say "txtEnterName").  I want to set txtName to the value of txtEnterName.  I am trying to do this with code like "ThisDocument.txtName = txtEnterName" in the form's code.  This works fine in the template, but whenever I create a new document from the template, it is the template's text field that's altered, not the current document's.

What should I be using instead of "ThisDocument"?


Thank you very much
0
Comment
Question by:c10
3 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 175 total points
ID: 9699422
ActiveDocument
0
 

Author Comment

by:c10
ID: 9756484
Damn that was obvious.

And sorry for the delay.
0
 
LVL 5

Expert Comment

by:scottman29
ID: 11786682
you just saved me a lot of extra time!  Thanks!!!!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…

792 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