Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default UserForm remembering Settings

Is it possible for a checkbox on a userform to be saved in the last
setting that the user left it in, when the user closes and saves the
workbook - without using any worksheet cells.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default UserForm remembering Settings

I am no MVP, but I'd say no. I would create
hidden "settings" worksheet and store user settings there.

-----Original Message-----
Is it possible for a checkbox on a userform to be saved

in the last
setting that the user left it in, when the user closes

and saves the
workbook - without using any worksheet cells.
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default UserForm remembering Settings

Jason,

The setting would have to be stored somewhere, such as in a worksheet cell,
a defined name, or in the system registry. You can use SaveSetting to store
the check box state in the registry when the form is closed, and then use
GetSetting to retrieve the setting when the form is initialized. For
example,

Private Sub UserForm_Initialize()
Me.CheckBox1.Value = CBool(GetSetting("AppName", "Setup", _
"CheckBox1State", "False"))
End Sub

Private Sub UserForm_Terminate()
SaveSetting "AppName", "Setup", "CheckBox1State", _
Format(Me.CheckBox1.Value)
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"jason" wrote in message
om...
Is it possible for a checkbox on a userform to be saved in the last
setting that the user left it in, when the user closes and saves the
workbook - without using any worksheet cells.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default UserForm remembering Settings


you'll have to use the registry using SaveSettings/GetSettings
or else you can easily store an array of values in a hidden name object

Sub Store()
Dim v
v = Array(1, "john", True)
ActiveWorkbook.Names.Add "myhiddensettings", v, False
End Sub



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


(jason) wrote:

Is it possible for a checkbox on a userform to be saved in the last
setting that the user left it in, when the user closes and saves the
workbook - without using any worksheet cells.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default UserForm remembering Settings

Cheers KIC

like your style - hidden named range

J

keepitcool wrote in message . ..
you'll have to use the registry using SaveSettings/GetSettings
or else you can easily store an array of values in a hidden name object

Sub Store()
Dim v
v = Array(1, "john", True)
ActiveWorkbook.Names.Add "myhiddensettings", v, False
End Sub



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


(jason) wrote:

Is it possible for a checkbox on a userform to be saved in the last
setting that the user left it in, when the user closes and saves the
workbook - without using any worksheet cells.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default UserForm remembering Settings

KIC

If I use this code:

Sub Store()

Dim v

v = Array(True, False, True)
ActiveWorkbook.Names.Add "XXX", v, False

End Sub

then what code do I use to extract say the second entry in the array
(the False entry) ?

Jason


keepitcool wrote in message . ..
you'll have to use the registry using SaveSettings/GetSettings
or else you can easily store an array of values in a hidden name object

Sub Store()
Dim v
v = Array(1, "john", True)
ActiveWorkbook.Names.Add "myhiddensettings", v, False
End Sub



keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


(jason) wrote:

Is it possible for a checkbox on a userform to be saved in the last
setting that the user left it in, when the user closes and saves the
workbook - without using any worksheet cells.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default UserForm remembering Settings

Jason, try:

Sub ReStore()
Dim v
v = Evaluate(ActiveWorkbook.Names("XXX").RefersTo)
msgbox "second entry is:" & v(2)
End Sub

pls note that Evaluate returns a 1based array!

keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


(jason) wrote:

KIC

If I use this code:

Sub Store()

Dim v

v = Array(True, False, True)
ActiveWorkbook.Names.Add "XXX", v, False

End Sub

then what code do I use to extract say the second entry in the array
(the False entry) ?

Jason


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remembering lookups Aitchy Excel Worksheet Functions 2 June 13th 08 09:53 AM
Remembering position in shared workbook David Trimboli Excel Discussion (Misc queries) 0 June 14th 07 02:21 PM
Remembering a value moving from one sheet to another Hitesh_sethi Excel Discussion (Misc queries) 3 April 27th 06 01:26 AM
Remembering Data Values. Workle New Users to Excel 1 February 10th 05 06:58 AM
Easy one: Remembering previous sheet name paul Excel Programming 2 August 13th 03 04:04 PM


All times are GMT +1. The time now is 10:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"