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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985
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.
 

Digitborn.com

Active Member
Joined
Apr 3, 2007
Messages
353
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"!?
 

Datsmart

Well-known Member
Joined
Jun 19, 2003
Messages
7,985
"A2" is a "reserved name", you can not use names that could be confused with cell addresses or funtions, etc.
 

Digitborn.com

Active Member
Joined
Apr 3, 2007
Messages
353

ADVERTISEMENT

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?
 

Digitborn.com

Active Member
Joined
Apr 3, 2007
Messages
353
I couldn't find in the VBA or Excel Help too. Nevermind, I learnt some good lessons for today :). Thanks for your inputs..
 

Forum statistics

Threads
1,136,215
Messages
5,674,435
Members
419,510
Latest member
greatglern

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
Top