Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
AJB AJB is offline
external usenet poster
 
Posts: 40
Default code reopens file

The following code tries to reopen my files 30-45 seconds after I close them.
Any ideas what might make it do this? The code is meant to track my time in
the different bids I work on

Thanks,

Andy

Code in module:
Public Sub StartCounting(Optional bStart As Boolean = False)
Const dINCREMENT As Date = #12:01:00 AM#
If Not bStart Then
With Sheets("Bid Summary").Range("J3")
..Value = .Value + dINCREMENT
End With
End If
dNextCall = Now + dINCREMENT
Application.OnTime dNextCall, "StartCounting", Schedule:=True
End Sub

Public Sub StopCounting()
Application.OnTime dNextCall, "StartCounting", Schedule:=False
End Sub

Code in workbook:
Public Sub StartCounting(Optional bStart As Boolean = False)
Const dINCREMENT As Date = #12:01:00 AM#
If Not bStart Then
With Sheets("Bid Summary").Range("J3")
..Value = .Value + dINCREMENT
End With
End If
dNextCall = Now + dINCREMENT
Application.OnTime dNextCall, "StartCounting", Schedule:=True
End Sub

Public Sub StopCounting()
Application.OnTime dNextCall, "StartCounting", Schedule:=False
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default code reopens file

Unless you are closing Excel you have to call the StopCounting routine
before you close the workbook, else Excel looks for the macro you scheduled.

--
Jim
"AJB" wrote in message
...
| The following code tries to reopen my files 30-45 seconds after I close
them.
| Any ideas what might make it do this? The code is meant to track my time
in
| the different bids I work on
|
| Thanks,
|
| Andy
|
| Code in module:
| Public Sub StartCounting(Optional bStart As Boolean = False)
| Const dINCREMENT As Date = #12:01:00 AM#
| If Not bStart Then
| With Sheets("Bid Summary").Range("J3")
| .Value = .Value + dINCREMENT
| End With
| End If
| dNextCall = Now + dINCREMENT
| Application.OnTime dNextCall, "StartCounting", Schedule:=True
| End Sub
|
| Public Sub StopCounting()
| Application.OnTime dNextCall, "StartCounting", Schedule:=False
| End Sub
|
| Code in workbook:
| Public Sub StartCounting(Optional bStart As Boolean = False)
| Const dINCREMENT As Date = #12:01:00 AM#
| If Not bStart Then
| With Sheets("Bid Summary").Range("J3")
| .Value = .Value + dINCREMENT
| End With
| End If
| dNextCall = Now + dINCREMENT
| Application.OnTime dNextCall, "StartCounting", Schedule:=True
| End Sub
|
| Public Sub StopCounting()
| Application.OnTime dNextCall, "StartCounting", Schedule:=False
| End Sub


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
Sort not saved across saves/reopens Shane Devenshire Excel Worksheet Functions 1 March 17th 09 08:03 PM
Workbook reopens after close John Michl Excel Programming 2 December 13th 06 10:49 PM
code to check file size everytime an Excel file is opened Kaiser[_2_] Excel Programming 2 July 30th 06 05:46 PM
Code in one workbook to call code in another XL file [email protected] Excel Programming 2 August 1st 05 03:37 PM
Import VBA Code in Excel-File ? (Export VBA Code to file) Matthias Pospiech Excel Programming 2 March 22nd 05 04:56 PM


All times are GMT +1. The time now is 02:33 AM.

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

About Us

"It's about Microsoft Excel"