public variables value preserving

A

Amir

Hi!

I would like to ask a simple question:

If I declare a public variable, which I use for a macro,
will it's value be saved until the next time I run that macro?

I'm not willing to save the value. I just want to know if I can know it'll
be 0 (for an integer) if I don't initialize it manually.
Are there any cases where the value will be saved?

Regards,
Amir.
 
J

Jonathan West

Amir said:
Hi!

I would like to ask a simple question:

If I declare a public variable, which I use for a macro,
will it's value be saved until the next time I run that macro?

I'm not willing to save the value. I just want to know if I can know it'll
be 0 (for an integer) if I don't initialize it manually.
Are there any cases where the value will be saved?

The value will be saved until the template is unloaded.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
J

Jay Freedman

Hi!

I would like to ask a simple question:

If I declare a public variable, which I use for a macro,
will it's value be saved until the next time I run that macro?

I'm not willing to save the value. I just want to know if I can know it'll
be 0 (for an integer) if I don't initialize it manually.
Are there any cases where the value will be saved?

Regards,
Amir.

Hi Amir,

If you don't explicitly save the value before shutting down Word and
explicitly retrieve it on the next startup, there's nothing in Word
that will save it automatically.

If you have more than one document open during a single session,
things can get confusing with public variables. But closing Word will
discard any values that are only in memory.
 
A

Amir

Thanks!!

Regards,
Amir.

Jay Freedman said:
Hi Amir,

If you don't explicitly save the value before shutting down Word and
explicitly retrieve it on the next startup, there's nothing in Word
that will save it automatically.

If you have more than one document open during a single session,
things can get confusing with public variables. But closing Word will
discard any values that are only in memory.
 

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