ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   A variable that save its value (https://www.excelbanter.com/excel-programming/340083-variable-save-its-value.html)

filo666

A variable that save its value
 
Hi, There is somehow a variable rememver his value allthought excel is
closed???
TKS

Dave Peterson

A variable that save its value
 
I think the easiest thing would be to put the value in a worksheet (and hide
that worksheet).

But you could use a Name, too.

Chip Pearson has some notes by Laurent Longre at:
http://www.cpearson.com/excel/hidden.htm

that uses a hidden name space.

filo666 wrote:

Hi, There is somehow a variable rememver his value allthought excel is
closed???
TKS


--

Dave Peterson

Dave Peterson

A variable that save its value
 
You may be able to just use a text file, too.

Kind of like an .INI file.

(I like the hidden worksheet--it seems easiest.)

filo666 wrote:

Hi, There is somehow a variable rememver his value allthought excel is
closed???
TKS


--

Dave Peterson

Peter T

A variable that save its value
 
Some possibilities-

If you only need the variable/value in a particular workbook -
A Defined name's refersto
some cell

Or for anything -
as above but in -
Personal.xls (save before you're asked to)
An addin (you won't get asked so save it)
some other workbook (perhaps in XLStart)

ini or text file
registry

Regards,
Peter T

"filo666" wrote in message
...
Hi, There is somehow a variable rememver his value allthought excel is
closed???
TKS




filo666

A variable that save its value
 
Thnak you (both of you), I thought about put the value in a cell but is more
interesting how to save it into another file (.ini), could some of you tell
me an example how to save the value in a file???

sub SaveTheValueOfAVariable()
dim a as string
a=cell(1,b)
'Here I want to save a so the next time excel is open a has his value
end sub
Tanks you very much
"Peter T" wrote:

Some possibilities-

If you only need the variable/value in a particular workbook -
A Defined name's refersto
some cell

Or for anything -
as above but in -
Personal.xls (save before you're asked to)
An addin (you won't get asked so save it)
some other workbook (perhaps in XLStart)

ini or text file
registry

Regards,
Peter T

"filo666" wrote in message
...
Hi, There is somehow a variable rememver his value allthought excel is
closed???
TKS





Peter T

A variable that save its value
 
In help see -

Print # Statement & Open # Statement

In the examples change "Testfile" to the full path & name.

Ini files are a bit more complicated and require API's, plenty of examples
in this ng.

Regards,
Peter T

"filo666" wrote in message
...
Thnak you (both of you), I thought about put the value in a cell but is

more
interesting how to save it into another file (.ini), could some of you

tell
me an example how to save the value in a file???

sub SaveTheValueOfAVariable()
dim a as string
a=cell(1,b)
'Here I want to save a so the next time excel is open a has his value
end sub
Tanks you very much
"Peter T" wrote:

Some possibilities-

If you only need the variable/value in a particular workbook -
A Defined name's refersto
some cell

Or for anything -
as above but in -
Personal.xls (save before you're asked to)
An addin (you won't get asked so save it)
some other workbook (perhaps in XLStart)

ini or text file
registry

Regards,
Peter T

"filo666" wrote in message
...
Hi, There is somehow a variable rememver his value allthought excel is
closed???
TKS







Dave Peterson

A variable that save its value
 
A little search of google will give you lots of hits:

http://groups.google.co.uk/group/mic...63099721c94c8e

or

http://snipurl.com/f0iz



filo666 wrote:

Thnak you (both of you), I thought about put the value in a cell but is more
interesting how to save it into another file (.ini), could some of you tell
me an example how to save the value in a file???

sub SaveTheValueOfAVariable()
dim a as string
a=cell(1,b)
'Here I want to save a so the next time excel is open a has his value
end sub
Tanks you very much
"Peter T" wrote:

Some possibilities-

If you only need the variable/value in a particular workbook -
A Defined name's refersto
some cell

Or for anything -
as above but in -
Personal.xls (save before you're asked to)
An addin (you won't get asked so save it)
some other workbook (perhaps in XLStart)

ini or text file
registry

Regards,
Peter T

"filo666" wrote in message
...
Hi, There is somehow a variable rememver his value allthought excel is
closed???
TKS





--

Dave Peterson

Rick S.

A variable that save its value
 
I use registry settings:
'======
Sub GetRegistrySetting()
'Begin Registry setting
'"appname:=" = Desired name you create, variable or "string", preferred
a "string"
'"section:=" = Desired name you create, variable or "string"
'"Key:=" = Desired name you create, variable or "string"
'Notes: Variables do not use quotes, strings use quotes
SomeVariable = GetSetting(appname:="AppNameHere",
section:="SectionNameHere", _
Key:="KeyNameHere")
'End registry setting
End Sub

Sub SetRegistrySetting()
'Begin Registry setting
'"appname:=" = Desired name you create, variable or string, preferred a
string
'"section:=" = Desired name you create, variable or string
'"Key:=" = Desired name you create, variable or string
'setting:=" = variable or string
SaveSetting appname:="AppNameHere", section:="SectionNameHere", _
Key:="KeyNameHere", setting:="SettingValueHere"
'End registry setting
End Sub
'======
--
Regards

VBA.Noob.Confused
XP Pro
Office 2007



"filo666" wrote:

Hi, There is somehow a variable rememver his value allthought excel is
closed???
TKS



All times are GMT +1. The time now is 03:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com