Storing A Variable on Close

poleary2000

Active Member
Joined
Apr 1, 2002
Messages
354
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?
 
I tested it
Found this error

If Err.num = 53 Then

Should be

If Err.Number = 53 Then

Besides that it works

Tom
 
Upvote 0

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Wow - yes it does work. However, will it work if I have the file in one directory, click the box, save, close, move the file and open again.

If not, I would rather try the name method suggested above [the code makes more sense to me].
 
Upvote 0
Hi
If you want the form to show when the workbook is moved:

In Sub CheckFileSwitch()

Change:

Open Application.Path & "/noopen" For Input As #1

To:

Open ActiveWorkbook.Path & "/noopen" For Input As #1


In Sub CheckBox1_Click()

Change:

Open Application.Path & "/noopen" For Output As #1

To:

Open ActiveWorkbook.Path & "/noopen" For Output As #1

Hope this helps,
Tom
 
Upvote 0

Forum statistics

Threads
1,214,813
Messages
6,121,706
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top