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
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