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!
 

Some videos you may like

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
6,787
Office Version
  1. 365
Platform
  1. Windows
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:

David Montoya

New Member
Joined
Apr 25, 2018
Messages
49
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!
 

Watch MrExcel Video

Forum statistics

Threads
1,109,518
Messages
5,529,312
Members
409,862
Latest member
lbisacca
Top