Message box when opening, show for a set time

CookieMonster76

Board Regular
Joined
Apr 30, 2015
Messages
200
Hi

I've found a couple of ways to display a message box for a set time, this is one of them.

Dim AckTime As Integer, InfoBox As Object
Set InfoBox = CreateObject("WScript.Shell")
AckTime = 10
Select Case InfoBox.Popup("Click OK (this window closes automatically after 10 seconds).", AckTime, "This is your Message Box", 0)
Case 1, -1
Exit Sub
End Select

The works when it's run in an already open workbook, but I want to display a message for a short period when the workbook opens for a short period. Using the code above the message appears but then doesn't go away after 20 seconds.

Is there a way to make it do so?

Thanks

Paul
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hi Cookie,

Is the code placed within the Workbook.Open() sub? Also, this might be a stupid response regarding the time... since the message appears for double the time you expect, have you tried setting AckTime = 5?
 
Upvote 0
Hi

Yes it is in the Workbook.open () sub - The message box appear just doesn't go away.

Yes, i had changed to 1 and 2 but still didn't work
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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