What is the error you are getting? The PACONT07 folder exists and you have access to it I assume...
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rodgers Chase Sent: Friday, March 14, 2008 7: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] CONFIDENTIALITY NOTICE: This message and any included attachments are from Salinas Valley Memorial Healthcare System and are intended only for the addressee. The information contained in this message is confidential and may constitute inside or non-public information under international, federal, or state securities laws. Unauthorized forwarding, printing, copying, distribution, or use of such information is strictly prohibited and may be unlawful. If you are not the addressee, please promptly delete this message and notify the sender of the delivery error by e-mail or you may call Salinas Valley Memorial Healthcare System's Privacy Officer in Salinas, California, U.S.A. at (+1) (831) 755-0751.
