Application.OnTime not working after converting from Excel 2010 to Excel 2016

Dojorgen

Board Regular
Joined
Mar 1, 2018
Messages
59
My simple run requests were working just fine until the 2016 excel upgrade. I tried to enable and disable options but nothing seems to be working.

Workbook:
Private Sub Workbook_Open()
Application.OnTime TimeValue(13:30:00), "Refresh"
Application.OnTime TimeValue(13:31:00), "Shutdown"
End Sub

Module:
Sub Refresh()
ActiveWorkbook.RefreshAll
End Sub

Sub Shutdown()
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
That syntax is not valid.

Code:
Application.OnTime TimeValue([COLOR="#FF0000"][SIZE=4]"[/SIZE][/COLOR]13:30:00[COLOR="#FF0000"][SIZE=4]"[/SIZE][/COLOR]), "Refresh"

Also, the code will close whatever workbook is active, maybe not the one you want.
 
Upvote 0
oh right forgot to put that in i.e.:

Application.OnTime TimeVlaue("13:30:00"), "Refresh"

Is not working for me but it did in the past
 
Upvote 0
The code looks fine to me, and I don't have Excel 2016 to test. You might try ...

Code:
Application.OnTime Date + TimeValue("13:30:00"), "Refresh"

... but that would be unnecessary in Excel 2010.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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