![]() |
Timer
I have a timer which is calls a function after 5 seconds
(using StartTimer and KillTimer). What I am trying to do once the timer is activated is to open another file (works OK) and then close the orginal file that contained the timer functions. The problem is that all of excel shuts down, including the newly opened spreadsheet. The code for closing files works as I use it often. Also, the Auto_Open () fails to run when I open the second excel file. Any thoughts? thanks |
Timer
Phil,
Does StartTimer and KillTimer use CallBack code by any chance? Auto_Open will not run for a file opened in VBA, you either need to run it explicitly, or use Workbook_Open event. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Phil" wrote in message ... I have a timer which is calls a function after 5 seconds (using StartTimer and KillTimer). What I am trying to do once the timer is activated is to open another file (works OK) and then close the orginal file that contained the timer functions. The problem is that all of excel shuts down, including the newly opened spreadsheet. The code for closing files works as I use it often. Also, the Auto_Open () fails to run when I open the second excel file. Any thoughts? thanks |
Timer
Hi Phil,
"and then close the orginal file that contained the timer functions." If you close the workbook containing the code, the code stops running! -- John johnf 202 at hotmail dot com "Phil" wrote in message ... | I have a timer which is calls a function after 5 seconds | (using StartTimer and KillTimer). What I am trying to do | once the timer is activated is to open another file (works | OK) and then close the orginal file that contained the | timer functions. The problem is that all of excel shuts | down, including the newly opened spreadsheet. The code for | closing files works as I use it often. Also, the Auto_Open | () fails to run when I open the second excel file. | | Any thoughts? | | thanks |
Timer
Hi Phil,
I have a timer which is calls a function after 5 seconds (using StartTimer and KillTimer). What I am trying to do once the timer is activated is to open another file (works OK) and then close the orginal file that contained the timer functions. The problem is that all of excel shuts down, including the newly opened spreadsheet. The code for closing files works as I use it often. Also, the Auto_Open () fails to run when I open the second excel file. Is there a reason you're using StartTimer and KillTimer (i.e. API-level calls) instead of Application.OnTime (i.e. application-level calls)? Regards Stephen Bullen Microsoft MVP - Excel www.BMSLtd.co.uk |
Timer
The crash *may* be because the callback routine has disappeared when
you closed the original workbook. Do you call KillTimer before closing the original workbook? If so, is it working? Also, it's a design intent that Auto_ procedures do not run when a workbook is opened programmatically. Either invoke the procedure explicitly or use a Workbook_Open procedure. -- Regards, Tushar Mehta, MS MVP -- Excel www.tushar-mehta.com Excel, PowerPoint, and VBA add-ins, tutorials Custom MS Office productivity solutions In article , says... I have a timer which is calls a function after 5 seconds (using StartTimer and KillTimer). What I am trying to do once the timer is activated is to open another file (works OK) and then close the orginal file that contained the timer functions. The problem is that all of excel shuts down, including the newly opened spreadsheet. The code for closing files works as I use it often. Also, the Auto_Open () fails to run when I open the second excel file. Any thoughts? thanks |
All times are GMT +1. The time now is 04:20 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com