Solved

VBA form in a Word template

Posted on 2003-11-06
3
381 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
Comment Utility
ActiveDocument
0
 

Author Comment

by:c10
Comment Utility
Damn that was obvious.

And sorry for the delay.
0
 
LVL 5

Expert Comment

by:scottman29
Comment Utility
you just saved me a lot of extra time!  Thanks!!!!
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…

763 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

9 Experts available now in Live!

Get 1:1 Help Now