Got it:
CStr(Year(Now)) & Right(00 & CStr(Month(Now)),2) & Right(00 &
CStr(Day(Now)),2) & Right(00 & CStr(Hour(Now)),2) & Right(00 &
CStr(Minute(Now)),2) & Right(00 & CStr(Second(Now)),2)
Format doesn't exist in VBS, so build your own!!
"Steph" wrote in message
...
Thanks Jim. It worked perfectly. But I messed it up a bit by trying to
have the copied file named as today's timestamp:
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.CopyFile sExcelPath, CopytoPath & Format(Now, "yyyymmddhhmmss") &
".xls"
When I ran, I got an error: Variable is undefined: 'Format'
So I'm guessing I am mixing VBA with VBS. Any idea how I would rewrite
this
in VBS syntax? Thanks!
"Jim Rech" wrote in message
...
This may help. Here is a VB script I use to copy my XLB backup files
over
the current XLBs. This goes in a VBS file as you know.
dim FSO
dim Path
Path = "C:\Documents and Settings\jarech\Application
Data\Microsoft\Excel\"
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.CopyFile Path & "Excel11Bak.xlb", Path & "Excel11.xlb"
FSO.CopyFile Path & "Excel10Bak.xlb", Path & "Excel10.xlb"
FSO.CopyFile Path & "ExcelBak.xlb", Path & "Excel.xlb"
--
Jim
"Steph" wrote in message
...
| Hello. I would like to schedule a VB Script to run (via Windows
Scheduler),
| which will simply copy a file from one directory into another with the
name
| of the copied file as as a today timestamp. I am extremely new to VB
| Script - can anyone help with the syntax? Thank you.
|
|
|