OnTime Method

Digitborn.com

Active Member
Joined
Apr 3, 2007
Messages
353
Hello,

On Forms - UserForm1 I have:
Code:
Private Sub CommandButton1_Click()
    UserForm1.Frame1.Visible = True
    Application.OnTime Now + TimeValue("00:00:04") , "DismissFrameVisability"
End Sub

Private Sub UserForm_Initialize()
    Frame1.Visible = False
End Sub

On a Modules - Module1:
Code:
Sub DismissFrameVisability()
    UserForm1.Frame1.Visible = False
End Sub

Why nothing happens, UserForm1.Frame1.Visible = False does not trigger after 4 seconds?

p.s. If I use Application.Wait (Now + TimeValue("0:00:04")), I can't click on the controls on Frame1 because they are locked until these 4 seconds past.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Just built a UserForm and tested your code.
Why do you have your Initialization code turning off Frame1 and then also have a command button to do the same thing?

I removed the Initialization code and the rest of the code hides Frame1 after 4 seconds.
 
Upvote 0
I found the problem. Except "DismissFrameVisability", I was named my procedure "A2". That's why nothing happens. Do you know why it's not accepting names like "A2"!?
 
Upvote 0
"A2" is a "reserved name", you can not use names that could be confused with cell addresses or funtions, etc.
 
Upvote 0
Can you tell me where I can find info on such kind of reserved names? Can I use letters + numbers for names or numbers are not allowed?
 
Upvote 0
I couldn't find in the VBA or Excel Help too. Nevermind, I learnt some good lessons for today :). Thanks for your inputs..
 
Upvote 0

Forum statistics

Threads
1,214,397
Messages
6,119,273
Members
448,883
Latest member
fyfe54

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