Carry a variable content to a new document

K

Krakmup

I generate a variable, named "MyVariable", using the Public statement. When
the variable is set, I want to use the contents in another document, using
the same name, within the new documents macro.

Example
MyVariable = "55555"
ChangeFileOpenDirectory _
"C:\MyDocuments\"
Documents.Open "Filename.doc"
Application.Run MacroName:="Look4Me"

In "Look4Me", I set a variable equal to MyVariable, but MyVariable is always
empty.
The original document which identified MyVariable is still open and running.

How can I keep the variable contents?
Tanks
 
W

Word Heretic

G'day "Krakmup" <[email protected]>,

the target document.vbproject.references needs a reference to your
original template so it can see your publics. Publics are not globals
- you have to reference their container.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


Krakmup reckoned:
 
K

Krakmup

Tanx Heretic
I did try Global, but that also did not work.
While I have refernced libraries, to reference another document is new, but
it worked just fine.

For other readers, make sure that you close the active documents in order of
their respective reference's
Krakmup
 

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