Also, when adding (subtracting) days from dates, you should use DateAdd(), not direct math.
DateAdd("d", -1, varDate)
Thank you,
Mitch Lawrence
Lead Applications Analyst
Technical Support - NPR/Automation
CHRISTUS Information Management
*: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
Send a "thank you
<http://intranet.christushealth.org/spiritBuck/Default.asp> " to
someone!
________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lawrence,
Mitchell
Sent: Friday, March 14, 2008 11:41 AM
To: [email protected]
Subject: RE: [Talk] Copy a file to two different locations
Where is f1.DateLastModified defined? (Don't you have to define "fl"?)
Thank you,
Mitch Lawrence
Lead Applications Analyst
Technical Support - NPR/Automation
CHRISTUS Information Management
*: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>
Send a "thank you
<http://intranet.christushealth.org/spiritBuck/Default.asp> " to
someone!
________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rodgers Chase
Sent: Friday, March 14, 2008 9:40 AM
To: [email protected]
Subject: [Talk] Copy a file to two different locations
Can anyone tell me why this code is bugging out?
The first copy is working, but the second copy (with mmddyy format)
isn't.
I highlighted in YELLOW and RED font the part that is bombing.
Sub CopyPACONT07()
'
Dim shell
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
'the following dims are used by CONT07 code
Dim MyPath As String
Dim MyDestination As String
Dim MyDestination2 As String
Dim MyFile As String
Dim MyNewFile As String
Dim MyNewFile2 As String
Dim MyName
Dim MyNameWithPath
Dim RetVal
'
'copies the daily PACONT07 report to two different places
MyPath = "\\Mcplwpshrc1\document$\VPOM\"
MyName = Dir(MyPath & "pacont07*.txt", vbDirectory)
MyNameWithPath = MyPath & MyName
MyDestination = "\\mcplwpshrc1\department$\Accounting\Plus
Multipliers\Plus Recon\673\"
MyNewFile = MyDestination & "PACONT07.txt"
Do While MyName <> ""
fso.CopyFile MyNameWithPath, MyNewFile, True
MyName = Dir
MyNameWithPath = MyPath & MyName
Loop
MyDestination2 = "\\mcplwpshrc1\department$\Accounting\Plus
Multipliers\Plus Recon\PACONT07\"
MyNewFile2 = MyDestination & "PACONT07" & Format(f1.DateLastModified
- 1, "_mmddyy") & ".txt"
Do While MyName <> ""
fso.CopyFile MyNameWithPath, MyNewFile2, True
MyName = Dir
MyNameWithPath = MyPath & MyName
Loop
'
Set fso = Nothing
'
End Sub
Thanks,
Chase Rodgers
Financial Reporting Manager
Medical Center of Plano
*214-473-7490
[EMAIL PROTECTED]
<<image002.jpg>>
<<image003.jpg>>
