Application.OnTime macro no longer running under Win 10 and Office 2016

David Montoya

New Member
Joined
Apr 25, 2018
Messages
49
Dear,
I have a macro which has been working for long time under Windows 7 and Office 2010; however, when migrating to Windows 10 and Office 2016, it stops working. I am wondering if the forum can assist me to identify the problem.
The first part deals with the execution at opening the workbook:

Code:
Private Sub Workbook_Open()
    Application.ScreenUpdating = False
    RunSchedule
    Application.DisplayAlerts = True
End Sub

The second part is the actual macro, which deal with the daily run schedule:

Code:
Sub RunSchedule()
If Environ$("username") = "abcdef" Then
Application.OnTime TimeValue("16:30:00"), "Append_and_PDFs"
ElseIf Environ$("username") = "ghijkl" Then
Application.OnTime TimeValue("16:35:00"), "Append_and_PDFs"
ElseIf Environ$("username") = "mnopqr" Then
Application.OnTime TimeValue("16:40:00"), "Append_and_PDFs"
End If
End Sub

By the way, the procedure “Append_and_PDFs" works fine if I execute it manually. I have tested the macro under the old environment, and it executes with no problem, but it does not run under the new environment. User names have not changed either.

Thank you!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
The code you posted works for me with Excel 365\Windows10

The problem is somewhere in Append_and_PDFs
-prove it by putting a message box as the first line of that procedure
- the message box appears for me, proving that the procedure has been triggered

Code:
MsgBox "Hello"
 
Last edited:
Upvote 0
Yonglo,

A couple of things:

1. I have three computers/users; the two computers under Win 7 - Office 2010 work perfect without a glitch, and
2. If I run the “Append_and_PDFs” manually, in both environments work fine.
Is there a different approach to schedule the automatic run using a different macro?
Thanks!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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