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

Re: Carry a variable content to a new document by Word

Word
Wed Sep 28 07:17:41 CDT 2005

G'day "Krakmup" <Krakmup@discussions.microsoft.com>,

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:

>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


Re: Carry a variable content to a new document by Krakmup

Krakmup
Wed Sep 28 11:00:02 CDT 2005

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

"Word Heretic" wrote:

> G'day "Krakmup" <Krakmup@discussions.microsoft.com>,
>
> 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:
>
> >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
>
>