Click here to Skip to main content
15,902,937 members

Comments by Member 10530881 (Top 4 by date)

Member 10530881 21-Jan-14 14:28pm View    
Hi Christian,
I do not know how to write a service. Below is my code. If I run the code, it works; however if I leave it with the OnTime statement, it does not run once the time approaches.

Sub openFile()

Application.OnTime TimeValue("13:00:00"), "refreshFile()"

End Sub

Sub refreshFile()

Workbooks.Open Filename:= _
"C:\Users\v-giwhal\Documents\Bulk Update Reports\FY14 CR CAM Qualified Opportunity Report"
Application.Run "'FY14 CR CAM Qualified Opportunity Report.xlsb'!refreshAll"
ActiveWorkbook.Save
ActiveWindow.Close

End Sub
Member 10530881 21-Jan-14 9:56am View    
That is not what I meant. I am new to code writing and miss used terminology. I want to lave my laptop on sleep or in hibernation mode but have a written code that will automatically run the macro after hours so the refreshes are completed overnight given the refresh time.
Member 10530881 21-Jan-14 9:52am View    
Below is my code and at the specified time, nothing is happening.

Sub openFile()

Application.OnTime TimeValue("9:50:00"), "refreshAll"

Workbooks.Open Filename:= _
"C:\Users\v-giwhal\Documents\Bulk Update Reports\FY14 CR CAM Qualified Opportunity Report"

Application.Run "'FY14 CR CAM Qualified Opportunity Report.xlsb'!refreshAll"
ActiveWorkbook.Save
ActiveWindow.Close

End Sub
Member 10530881 21-Jan-14 8:31am View    
Yes, I am looking for a code to start a macro I wrote while the computer is in sleep or hibernating for example. The total refresh time is 6+ hours and I am trying to find a way to do this outside of work hours in lieu of waking up at 2 a.m. to start the macro. I am new to writing codes and macros; therefore any assistance would be greatly appreciated.