I have an AutoExec macro that obtains the name of the
provider who will be using the terminal. The name is
stored in a public variable called "provider" and it is
entered into a note via other macros.

Problem: after a few times the variable is applied to
documents and printed, the variable gets "empty" and no
longer keeps the provider's name.
I'm using Word 2002
Any help will be appreciated.

Public Provider As String
Sub AutoExec()

Provider = InputBox("Please enter your Name and title as
your signature", "Provider Identity")
Who = MsgBox("Please Click File, Open and Select by double
clicking your directory, " + Chr(10) + Chr(10)
+ "corresponding to " + (Provider) + " then Cancel",
48, "Find Your Directory")

End Sub

Re: Disappearing variable by mksmith

mksmith
Tue Sep 16 10:52:14 CDT 2003

This variable is being held within a .dot file within the user's start-up
folder?

Malc
www.dragondrop.com

Re: Disappearing variable by Sergio

Sergio
Tue Sep 16 13:00:41 CDT 2003

yes, it is held in the Normal.dot global template
>-----Original Message-----
>This variable is being held within a .dot file within the
user's start-up
>folder?
>
>Malc
> www.dragondrop.com
>.
>

Re: Disappearing variable by Jezebel

Jezebel
Tue Sep 16 18:32:47 CDT 2003

There are several events that clear global variables while Word is running.
The most common is doing anything in the VBE environment -- editing a macro
for example. This resets the VBE 'project' which, amongst other things,
clears all variables.

Perhaps a better method for what you're trying to do would be to store the
value in a non-volatile way: in the registry or as a CustomDocumentProperty,
DocVariable, AutoText entry (etc) in normal.dot.


"Sergio Crisalle" <Crisalle@hotmail.com> wrote in message
news:42c601c37c5f$96f56db0$a501280a@phx.gbl...
> I have an AutoExec macro that obtains the name of the
> provider who will be using the terminal. The name is
> stored in a public variable called "provider" and it is
> entered into a note via other macros.
>
> Problem: after a few times the variable is applied to
> documents and printed, the variable gets "empty" and no
> longer keeps the provider's name.
> I'm using Word 2002
> Any help will be appreciated.
>
> Public Provider As String
> Sub AutoExec()
>
> Provider = InputBox("Please enter your Name and title as
> your signature", "Provider Identity")
> Who = MsgBox("Please Click File, Open and Select by double
> clicking your directory, " + Chr(10) + Chr(10)
> + "corresponding to " + (Provider) + " then Cancel",
> 48, "Find Your Directory")
>
> End Sub
>



Re: Disappearing variable by Word

Word
Fri Sep 19 04:46:37 CDT 2003

G'day Sergio,

unfortunately Jez is a clueless beginner hack whose advice in this
case will lead you astray. Don't store anything in Normal.dot ever.

You can simply set those suggested variables in the document itself,
where it belongs, or the registry.



"Jezebel" <grocer@play.net> was spinning this yarn:

>There are several events that clear global variables while Word is running.
>The most common is doing anything in the VBE environment -- editing a macro
>for example. This resets the VBE 'project' which, amongst other things,
>clears all variables.
>
>Perhaps a better method for what you're trying to do would be to store the
>value in a non-volatile way: in the registry or as a CustomDocumentProperty,
>DocVariable, AutoText entry (etc) in normal.dot.
>
>
>"Sergio Crisalle" <Crisalle@hotmail.com> wrote in message
>news:42c601c37c5f$96f56db0$a501280a@phx.gbl...
>> I have an AutoExec macro that obtains the name of the
>> provider who will be using the terminal. The name is
>> stored in a public variable called "provider" and it is
>> entered into a note via other macros.
>>
>> Problem: after a few times the variable is applied to
>> documents and printed, the variable gets "empty" and no
>> longer keeps the provider's name.
>> I'm using Word 2002
>> Any help will be appreciated.
>>
>> Public Provider As String
>> Sub AutoExec()
>>
>> Provider = InputBox("Please enter your Name and title as
>> your signature", "Provider Identity")
>> Who = MsgBox("Please Click File, Open and Select by double
>> clicking your directory, " + Chr(10) + Chr(10)
>> + "corresponding to " + (Provider) + " then Cancel",
>> 48, "Find Your Directory")
>>
>> End Sub
>>
>

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email steve@wordheretic.com
Products http://www.geocities.com/word_heretic/products.html

Replies offlist may require payment.

Re: Disappearing variable by mksmith

mksmith
Fri Sep 19 05:12:33 CDT 2003

Would it be appropriate to get the user's login name for the machine that
they used? If they are logging onto a network then calling the
GetUserName() API could be useful.

If this is the case, then please let me know and I'll knock up some code
for you.

Regards
Malc
www.dragondrop.com

Re: Disappearing variable by Sergio

Sergio
Fri Sep 19 14:10:46 CDT 2003

The login name is not the same as the Provider name. The
network uses the user&#8217;s initials and employee number,
instead of their full names.
Thanks I already have the code for obtaining the user
name. Since the templates are stored in the network under
a private folder called like the user&#8217;s name, and only
available to administrators and the user himself, when I
distribute new templates I get their user name assign it
to a variable that becomes part of the path to copy the
files to their folder.
My problem is that the macros do not open vba or change
anything, and the Provider variable becomes &#8220;empty&#8221; every
now and then. Some days it runs flawlessly the entire
session. Some other days, it keeps the Provider&#8217;s name
perhaps six times or less.
The Program is used in the following way:
A user starts Word, and enters his/her name. This name is
kept in the Provider variable (public). They are health
care providers. After they see a patient they create a
document from a template that enters their name at the
bottom for the signature and identification (simple
macro). Very straight forward, no other interaction
happens. We are using Word 2002 on a Windows NT network.
On IBM Pentium II machines with 256 K RAM
What could cause the variable to behave so erratic?

>-----Original Message-----
>Would it be appropriate to get the user's login name for
the machine that
>they used? If they are logging onto a network then
calling the
>GetUserName() API could be useful.
>
>If this is the case, then please let me know and I'll
knock up some code
>for you.
>
>Regards
> Malc
> www.dragondrop.com
>.
>