Problem with Visual Basic code working in a Word Document.

R

robbyp

I have a standard Word document where I have created two text fields from the
control toolbox. I have simple VB code for change as follows:

Textbox1.text = Textbox2.text

When Textbox2 changes, so does the text in Textbox1. It works fine. However,
when I close Word and then re-open, it never works. What gives? Thanks for
your help.
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?cm9iYnlw?=,
I have a standard Word document where I have created two text fields from the
control toolbox. I have simple VB code for change as follows:

Textbox1.text = Textbox2.text

When Textbox2 changes, so does the text in Textbox1. It works fine. However,
when I close Word and then re-open, it never works. What gives?
I suspect it may be a question of exactly where the code is stored. There's an
article on msdn.microsoft.com (search my name and ActiveX and you should turn it
up) that describes some of the "ins and outs" of where the code is stored and
how it acts that might shed some light on the problem for you.

Is this really a document, or is it a template from which you're creating a new
document (and that's when it stops)?

Is the code in the ThisDocument module, or another one?

Is this exactly the line of code? You haven't qualified the controls with
ThisDocument or ActiveDocument?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top