![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Apr 2002
Location: Pittsburgh, PA
Posts: 317
|
I have code that runs upon opening. The code opens a UserForm that asks the user a question. I would like to have an option to turn the UserForm on or off WITHOUT storing a value in a worksheet. I guess I would like to have a check box like to have a check box on the UserForm that asks the user if they would like to see the form on Startup. Can this be done?
__________________
Thanks in advance, Patrick |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Apr 2002
Location: Pittsburgh, PA
Posts: 317
|
I need to do this ASAP. Any ideas?
__________________
Thanks in advance, Patrick |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
As far as I can tell, you are going to need to store a value somewhere...
Why are you against storing a value on the workbook itself? Place checkbox1 with the caption "Do not show this again." Place a value of true on some forsaken range somewhere and then check the value of this cell to determine if the form will show or not... If for some reason you cannot use the workbook, use a text file or the registry if you know how... Tom |
|
|
|
|
|
#4 |
|
Board Regular
Join Date: Apr 2002
Location: Pittsburgh, PA
Posts: 317
|
It is hard to explain the reason. The particular code that is running does not compare the values on any sheet currently. Plus, at anytime the user could delete any worksheet in the book so I have no idea where to store it [because it could get deleted].
I would rather not use the registry [don't know how anyway]. |
|
|
|
|
|
#5 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Would storing the value to a Name work?
In a workbook_before close event you can do something like: X = 34 Names.Add Name:="StoredNum", RefersTo:=X You don't have to hardcode X; you can get/calculate/increment it from somewhere else. Then, your UserForm can refer to "StoredNum" to do what you want. HTH, Jay |
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Mar 2002
Posts: 363
|
Try saving in a worksheet that's very hidden (it can't be unhide via worksheet menu, only by VBA). Or you could use a text file.
__________________
It's never too late to learn something new. Ricky |
|
|
|
|
|
#7 | |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Ok
That makes sense... You could create a hidden worksheet... If you think that is too much overhead then perhaps some code like this will do... Quote:
Try it out. Tom |
|
|
|
|
|
|
#8 |
|
Board Regular
Join Date: Apr 2002
Location: Pittsburgh, PA
Posts: 317
|
Tom,
Does this actually create a file? I'm not sure I completely understand it but I'll try it. Thanks, Patrick |
|
|
|
|
|
#9 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Yes
A blank file with no extension It holds no value If it exists, the form will not show Visa versa. I might have the wrong slash / or I'm always getting them mixed up |
|
|
|
|
|
#10 |
|
Board Regular
Join Date: Apr 2002
Location: Pittsburgh, PA
Posts: 317
|
So will it work if the user moves the file to a different directory.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|