
Saving open file and opening new file at a specified time of day
Cool. Thanks..
On Wed, 9 Jan 2002 15:54:35 +0100, "Mike Musterd"
Quote:
>Ooops...
>Of course the Datum = Date() line should be inside the Do loop, otherwise it
>would be a lot of open workbooks at 0:00 :)))
>Mike
>> Run something like the following script:
>> ---8<--------------------------------------------------
>> Set objXL = CreateObject("Excel.Application")
>> Datum = Date()
>> ' The main loop
>> Do
>> FName = OpenFile()
>> While Datum = Date()
>> ' Sleep for one second
>> Wscript.Sleep 1000
>> Wend
>> CloseFile(FName)
>> Loop While True
>> Function OpenFile()
>> Set objWorkBook = objXL.Workbooks.Add
>> objXL.DisplayAlerts = False
>> objWorkBook.Activate
>> objWorkBook.SaveAs "test" & Date()
>> objXL.Application.Visible = True
>> objXL.DisplayAlerts = True
>> 'Work here
>> OpenFile = "test" & Date()
>> End Function
>> Sub CloseFile()
>> objXL.WorkBooks(FName).Close
>> End Sub
>> ---8<--------------------------------------------------
>> > Hi,
>> > This is all pretty new to me, but I was wondering how difficult it is
>> > to do this:
>> > I start with an open spreadsheet "Excel_01_07_02.xls".
>> > At 12 midnight,I'd like to close that file and open a new one,
>> > "Excel_01_02_08.xls".
>> > Is this possible ?
>> > The name of the file doesn't matter too much, I was just thinking of
>> > matching the name to the date for ease of sorting.
>> > Thanks for your help,
>> > Jim
Jim Snodgrass
S and S Communications
AT&T/Lucent/Avaya Product Specialists
315-626-3289 Office
315-415-7115 Cell
"You cannot escape the responsibility of tomorrow by evading it today."
-Abraham Lincoln