Run time error 1004 - Method OnTime of Object _Application failed.

danbates

Active Member
Joined
Oct 8, 2017
Messages
377
Office Version
  1. 2016
Platform
  1. Windows
Hi,

Please can someone help?

I have a file I am trying to open from another excel file with the following code:

VBA Code:
Sub CILHyperLink()
Workbooks.Open ("C:\XxudV7g3hu\Dan Bates\Palletiser\2020\Palletiser CIL Sign Off.xlsm")
End Sub

but when I do I get the Run time error 1004 - Method OnTime of Object _Application failed on the second line of the following code:

VBA Code:
Sub StopTimer()
    On Error Resume Next
    Application.OnTime EarliestTime:=DownTime, Procedure:="ShutDown", Schedule:=False
 End Sub

but when I open the file straight from a shortcut off the desktop of the PC, it opens normally without the error.

Any help would be appreciated.

Thanks

Dan
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
The two subroutines are (seemingly) unrelated. How does running the first one produce an error in the second one? I feel like something is missing from your problem description.
 
Upvote 0
Hi,

I've just searched through the code and I found these 2 codes.

VBA Code:
Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
    Call StopTimer
    Call SetTimer
End Sub

VBA Code:
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _
  ByVal target As Excel.Range)
    Call StopTimer
    Call SetTimer
End Sub

Do these give you a better idea?

Thanks

Dan
 
Upvote 0
Are uyu certain that the filepath or filename has not changed
 
Upvote 0
Hi,

I have just opened the file from my shortcut on my desktop and now I'm getting the same error when I enter my data, but not when the file is opening.

I have found the code I am using online and I have copied a pasted it in again just in case I had done something to it but I am still getting the error.

This is the code I have been using:
 
Upvote 0

Forum statistics

Threads
1,215,692
Messages
6,126,230
Members
449,303
Latest member
grantrob

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top