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

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
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,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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