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
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,214,976
Messages
6,122,539
Members
449,088
Latest member
RandomExceller01

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