help_questions
Board Regular
- Joined
- Aug 22, 2005
- Messages
- 215
THis is the code that I use to save my file:
ChDir "C:\"
ActiveWorkbook.SaveAs Filename:="C:\September_22_2006_11.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
ActiveWindow.Close
I want to add an if statement to the code that will do the following:
If the current time is between 9am and 12pm, save the file as C:\Reports\Report1
If the current time is between 12:01pm and 3pm, save the file as C:\Reports\Report2
If the current time is between 3:01pm and 7pm, save the file as C:\Reports\Report3
If the current time is between 7:01pm and 11:59pm, save the file as C:\Reports\Report4
Any help with this would be greatly appreciated.
Thanks
ChDir "C:\"
ActiveWorkbook.SaveAs Filename:="C:\September_22_2006_11.xls", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
, CreateBackup:=False
ActiveWindow.Close
I want to add an if statement to the code that will do the following:
If the current time is between 9am and 12pm, save the file as C:\Reports\Report1
If the current time is between 12:01pm and 3pm, save the file as C:\Reports\Report2
If the current time is between 3:01pm and 7pm, save the file as C:\Reports\Report3
If the current time is between 7:01pm and 11:59pm, save the file as C:\Reports\Report4
Any help with this would be greatly appreciated.
Thanks