Solved: vb macro timeout a msgbox

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

balloon_tom

Thread Starter
Joined
Jan 4, 2006
Messages
107
Good afternoon all,
I have created a workbook which is scheduled to open at 5:00 every morning. The workbook goes online to get data using 'Sub Workbook_Open()' as soon as it opens. This part works great. Later, I would like to open the workbook to review the data WITHOUT it going on line immediately. My thought is to have Workbook_Open first display a MsgBox "AutoRun Yes/No?". (This I can do.). Then after a 60 second period with no responce, timeout the MsgBox and continue going on line.
Question: How on Earth do you timeout a MsgBox? It seems that once it has opened, all other functions are locked out until I press Yes or No.
I will be away from the computer for a couple of hours but I know when I get back you folks will have solved another one of my grammer school problems.
Thanks
 

OBP

Joined
Mar 8, 2005
Messages
19,896
Why not just check the time and if it is not 5.00 stop the code?
 
Joined
Jan 19, 2005
Messages
1,351
wow I did not know that is even possible!!

Can someone direct to as to how to schedule out for it to open/close a spread sheet at a given time?
 
Joined
Aug 5, 2005
Messages
3,086
I don't know if you can kill a message box without using API. Even then, I bet it'd take a ton of code. OBP's userform idea is better, but the implementation would be tricky. I'm not sure Excel supports Timer events. There is a Timer object that returns the system time; you could use it to establish a duration, and pass the start time and duration to different events. At some point you'd need a loop, which means the procedure would totally lose control. So, the calling routine would have to encapsulate the userform being opened.

Or, boy. I don't know about this one, but it may be possible. If you found the ProcID for the message box, you might be able to kill it. I really don't know. I don't think VBA is robust enough to pull that off.

Sorry, I don't have any good ideas.

chris.
 
Joined
Aug 5, 2005
Messages
3,086
Glad you got it sorted (y)

You can mark this thread Solved using the Thread Tools at the top of the page.

Just for giggles, how'd you swing it? Apparently the solution was significantly less complex than I thought. Or, I'm an idiot.

Which is true.

chris.
 
Joined
Jan 19, 2005
Messages
1,351
Thanx tom, forgot about Scheduled Tasks! duh im a tard... I was thinking it was excel that did it.. lol sorry
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top