Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 266
Default Excel can't find macro

This is a strange and difficult issue. I'm running Application.OnTime to
close a shared workbook after 1 hour of inactivity. This prevents a user
from locking up the workbook. When testing this on my home computer, it
works well. However on the system at work there is a problem. It seems if
the user is another workbook, Excel can't find the "SaveAndClose " macro (I
don't recall the exact error message - something like "unable to locate macro
"SaveAndClose". I do the same thing at home and it works fine. Any ideas on
what could be causing this? The macro is shown below and is in the
"ThisWorkbook" code. The SaveAndClose macro is in a general module. Thanks.

Private Sub Workbook_Open()
On Error Resume Next
Application.OnTime RunWhen, "SaveAndClose", , False
On Error GoTo 0
RunWhen = Now + TimeSerial(0, NUM_MINUTES, 0)
Application.OnTime RunWhen, "SaveAndClose", , True
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.OnTime RunWhen, "SaveAndClose", , False
On Error GoTo 0
End Sub

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
On Error Resume Next
Application.OnTime RunWhen, "SaveAndClose", , False
On Error GoTo 0
RunWhen = Now + TimeSerial(0, NUM_MINUTES, 0)
Application.OnTime RunWhen, "SaveAndClose", , True
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Range)

On Error Resume Next
Application.OnTime RunWhen, "SaveAndClose", , False
On Error GoTo 0
RunWhen = Now + TimeSerial(0, NUM_MINUTES, 0)
Application.OnTime RunWhen, "SaveAndClose", , True

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,355
Default Excel can't find macro

Where are you defining RUNWHEN and NUM_MINUTES?

"dhstein" wrote:

This is a strange and difficult issue. I'm running Application.OnTime to
close a shared workbook after 1 hour of inactivity. This prevents a user
from locking up the workbook. When testing this on my home computer, it
works well. However on the system at work there is a problem. It seems if
the user is another workbook, Excel can't find the "SaveAndClose " macro (I
don't recall the exact error message - something like "unable to locate macro
"SaveAndClose". I do the same thing at home and it works fine. Any ideas on
what could be causing this? The macro is shown below and is in the
"ThisWorkbook" code. The SaveAndClose macro is in a general module. Thanks.

Private Sub Workbook_Open()
On Error Resume Next
Application.OnTime RunWhen, "SaveAndClose", , False
On Error GoTo 0
RunWhen = Now + TimeSerial(0, NUM_MINUTES, 0)
Application.OnTime RunWhen, "SaveAndClose", , True
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.OnTime RunWhen, "SaveAndClose", , False
On Error GoTo 0
End Sub

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
On Error Resume Next
Application.OnTime RunWhen, "SaveAndClose", , False
On Error GoTo 0
RunWhen = Now + TimeSerial(0, NUM_MINUTES, 0)
Application.OnTime RunWhen, "SaveAndClose", , True
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Range)

On Error Resume Next
Application.OnTime RunWhen, "SaveAndClose", , False
On Error GoTo 0
RunWhen = Now + TimeSerial(0, NUM_MINUTES, 0)
Application.OnTime RunWhen, "SaveAndClose", , True

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,355
Default Excel can't find macro

Have you tried

Application.Run "'" & thisworkbook.name & "'!SaveAndClose"

"dhstein" wrote:

This is a strange and difficult issue. I'm running Application.OnTime to
close a shared workbook after 1 hour of inactivity. This prevents a user
from locking up the workbook. When testing this on my home computer, it
works well. However on the system at work there is a problem. It seems if
the user is another workbook, Excel can't find the "SaveAndClose " macro (I
don't recall the exact error message - something like "unable to locate macro
"SaveAndClose". I do the same thing at home and it works fine. Any ideas on
what could be causing this? The macro is shown below and is in the
"ThisWorkbook" code. The SaveAndClose macro is in a general module. Thanks.

Private Sub Workbook_Open()
On Error Resume Next
Application.OnTime RunWhen, "SaveAndClose", , False
On Error GoTo 0
RunWhen = Now + TimeSerial(0, NUM_MINUTES, 0)
Application.OnTime RunWhen, "SaveAndClose", , True
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.OnTime RunWhen, "SaveAndClose", , False
On Error GoTo 0
End Sub

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
On Error Resume Next
Application.OnTime RunWhen, "SaveAndClose", , False
On Error GoTo 0
RunWhen = Now + TimeSerial(0, NUM_MINUTES, 0)
Application.OnTime RunWhen, "SaveAndClose", , True
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Range)

On Error Resume Next
Application.OnTime RunWhen, "SaveAndClose", , False
On Error GoTo 0
RunWhen = Now + TimeSerial(0, NUM_MINUTES, 0)
Application.OnTime RunWhen, "SaveAndClose", , True

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
How do I find a macro in Excel? RJ Excel Worksheet Functions 2 March 4th 09 10:43 PM
Excel 2K3 Macro - Find and Update kdub-u Excel Worksheet Functions 2 August 30th 06 07:14 PM
How do I use find in a macro in Excel Layna Excel Worksheet Functions 2 May 20th 05 02:20 PM
How do I find a Macro in Excel when I don't know its name? LLEECEE Excel Discussion (Misc queries) 2 March 31st 05 10:28 PM
macro to Find Replace in Excel Nurddin Excel Discussion (Misc queries) 7 January 3rd 05 04:29 AM


All times are GMT +1. The time now is 05:12 PM.

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"