Hi below is some code I've used before. But what I need is a way to refresh a PowerPivot or PowerQuery every hour unit 10pm.
I want to pull in our stores sales and have it refresh every hour in the background.
Then I want to send out emails. I have that code but need to automate calling the email code.
Thanks
Sub RunOnTheHour()
Dim NextHour As Date 'Next on-the-hour time
Dim FracDays As Date
FracDays = (Int(Time() * 24) + 1) / 24
NextHour = Date + FracDays
Application.OnTime NextHour, "CDO_SNAP"
End Sub
Sub stopEm()
Application.OnTime TimeValue("22:00:00"), "CDO_SNAP", False
End Sub
I want to pull in our stores sales and have it refresh every hour in the background.
Then I want to send out emails. I have that code but need to automate calling the email code.
Thanks
Sub RunOnTheHour()
Dim NextHour As Date 'Next on-the-hour time
Dim FracDays As Date
FracDays = (Int(Time() * 24) + 1) / 24
NextHour = Date + FracDays
Application.OnTime NextHour, "CDO_SNAP"
End Sub
Sub stopEm()
Application.OnTime TimeValue("22:00:00"), "CDO_SNAP", False
End Sub