#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
jaf jaf is offline
external usenet poster
 
Posts: 300
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default 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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Timer in VBA peyman Excel Discussion (Misc queries) 2 October 5th 07 06:53 PM
Timer Vijay Excel Worksheet Functions 1 April 6th 07 11:00 AM
Lap-timer kabildgaard Excel Discussion (Misc queries) 0 August 11th 06 03:26 PM
Stopping a Timer / Running a timer simultaneously on Excel Paul23 Excel Discussion (Misc queries) 1 March 10th 06 12:08 PM
API Timer Seth[_5_] Excel Programming 2 January 13th 04 05:39 PM


All times are GMT +1. The time now is 11:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"