code reopens file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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
| 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

2 codes in one sheet 5
Refresh data with macro code 0
Run time error 2
making a countdown timer 1
Stopping a timer 10
Two codes in one set. 1
Scraping a specific line # from an email text 2
Adding code 5

Back
Top