Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Save variables in Excel?

Sorry for bothering again, but Im quite desperate about this. I want some
variables to follow my workbook. I want them to be just like static variables
are for functions. As i have it now, they are reset each time I open my workbook.
Where should I put them, and how do I declare them?
[297 byte] By [Jimmy] at [2007-11-10 12:19:53]
# 1 Re: Save variables in Excel?
Maybe you van write them to a text file before saving if you don't want to
save the values in the document. On opening a file you can check for text
files (with the same name to keep it simple) and read the variables using
a VBA routine.

If you are not bothered by saving them in your worksheet save them there
and develop a routine to read them from the workbook on opening.

I don't think, but I'm not sure, it is possible to keep a variable 'alive'
after closing the workbook in which it is declared.

Good luck!

Jonathan

"Jimmy" <vb.@127.0.0.1> wrote:
>
>Sorry for bothering again, but Im quite desperate about this. I want some
>variables to follow my workbook. I want them to be just like static variables
>are for functions. As i have it now, they are reset each time I open my
workbook.
>Where should I put them, and how do I declare them?
Jonathan Martens at 2007-11-11 18:11:49 >
# 2 Re: Save variables in Excel?
You may find it possible to save the values to the system Registry, using
the VBA functions GetSetting and SaveSetting. If you need assistance, just
ask.

Arthur Wood

"Jimmy" <vb.@127.0.0.1> wrote:
>
>Sorry for bothering again, but Im quite desperate about this. I want some
>variables to follow my workbook. I want them to be just like static variables
>are for functions. As i have it now, they are reset each time I open my
workbook.
>Where should I put them, and how do I declare them?
Arthur Wood at 2007-11-11 18:12:48 >
# 3 Re: Save variables in Excel?
Hi,

Try saving them in hidden names if you don't want casual users to have
access to them.

HTH

--
Rob

Excel VBA Programming Stuff:
www.analytical-dynamics.co.uk/

Please keep conversations in the newsgroup so that all may contribute and
benefit.

"Jimmy" <vb.@127.0.0.1> wrote in message news:3d2a8ccf$1@10.1.10.29...
>
> Sorry for bothering again, but Im quite desperate about this. I want some
> variables to follow my workbook. I want them to be just like static
variables
> are for functions. As i have it now, they are reset each time I open my
workbook.
> Where should I put them, and how do I declare them?
Rob Bruce at 2007-11-11 18:13:46 >
# 4 Re: Save variables in Excel?
I have checked the help about these functions, but I don't understand them.
But if it works I really want to know how to use them. Saving to a text file
is no alternative, cause users only want one file, and putting information
on worksheets i think could be a little bit to hard.

I have this kind of object structure
Object1= Data+collection of Object2
Object2= Data+collection of Object3
Object3= Data

I want these objects to be saved in the same file as
MyWorkBook.xls

Could you help me with that?

Jimmy

"Arthur Wood" <wooda@nospam.com> wrote:
>
>You may find it possible to save the values to the system Registry, using
>the VBA functions GetSetting and SaveSetting. If you need assistance, just
>ask.
>
>Arthur Wood
>
>
>"Jimmy" <vb.@127.0.0.1> wrote:
>>
>>Sorry for bothering again, but Im quite desperate about this. I want some
>>variables to follow my workbook. I want them to be just like static variables
>>are for functions. As i have it now, they are reset each time I open my
>workbook.
>>Where should I put them, and how do I declare them?
>
Jimmy at 2007-11-11 18:14:51 >
# 5 Re: Save variables in Excel?
Just a question? Could it be possible to assign a new property somewhere in
the workbook. Thinking about the Document properties collection. Do you know
anything about that?

Jimmy

"Arthur Wood" <wooda@nospam.com> wrote:
>
>You may find it possible to save the values to the system Registry, using
>the VBA functions GetSetting and SaveSetting. If you need assistance, just
>ask.
>
>Arthur Wood
>
>
>"Jimmy" <vb.@127.0.0.1> wrote:
>>
>>Sorry for bothering again, but Im quite desperate about this. I want some
>>variables to follow my workbook. I want them to be just like static variables
>>are for functions. As i have it now, they are reset each time I open my
>workbook.
>>Where should I put them, and how do I declare them?
>
Jimmy at 2007-11-11 18:15:49 >
# 6 Re: Save variables in Excel?
On 10 Jul 2002 05:54:05 -0700, "Jimmy" <plarssson@hotmail.com> wrote:

Just a question? Could it be possible to assign a new property somewhere in
the workbook. Thinking about the Document properties collection. Do you know
anything about that?

Yes, you can use the CustomDocumentProperties collection to add and delete custom properties.

Paul ~~~ pclement@ameritech.net
Microsoft MVP (Visual Basic)
Paul Clement at 2007-11-11 18:16:48 >