Ontime vba schedule on server

Jim_Doug

New Member
Joined
Aug 31, 2012
Messages
8
Hi All,

I want to schedule a report on a server PC that is always on.
The vba code has to pick up the file and save it, if available, from 05.00 till 08.00. Every day automatically.
If the file is not available the macro should re-run every 30 minute till the vba get the file or 08.00.
I wrote a macro but it doesn`t work.

Does anybody has a clue?
You would help me very much

Kind regard,
Jim

--------------------------------------------
Sub ScheduleAMacro()

Application.OnTime TimeValue("05:00:00"), "CopyFile", TimeValue("08:00:00")

Application.OnTime Now + TimeSerial(0, 30, 0), "ScheduleAMacro"

End Sub


Sub CopyFile()
Dim Link_Location_EOL_Unmatched As String
Dim Save_Location_EOL_Unmatched As String

Mail_To = Sheets("MAIN").Range("=Link_Location_EOL_Unmatched")
Mail_CC = Sheets("MAIN").Range("=Save_Location_EOL_Unmatched")

Workbooks.Open (Link_Location_EOL_Unmatched)
ActiveWorkbook.save (Save_Location_EOL_Unmatched)

End Sub
 

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Watch MrExcel Video

Forum statistics

Threads
1,123,516
Messages
5,602,112
Members
414,504
Latest member
Ganga Praveen

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
Top