J
justin.arnold2
We have a spreadsheet with a few buttons on it. One of the buttons is
called Distribute Sheet. When the user clicks this button the excel
sheet is first converted to a pdf document and then stored on a
network drive. Once this is complete the source file is copied to
another network location and renamed "today's date".pdf. We've been
running this without a problem for months. All of a sudden we've been
receiving the Run Time Error 53 on the FileCopy SourceFile,
DestinationFile line. There have been no changes to the code nor have
there been changes to the users PC. Can someone help me sort this out?
Please see the code below. Any help would be greatly apprecaited.
Thanks
Private Sub cmdDistributeNightOrders_Click()
Dim fName
Dim MyMonth
Dim MyDay
Dim MyYear
Dim SourceFile, DestinationFile As String
MyMonth = Month(Now)
MyDay = Day(Now)
MyYear = Year(Now)
fName = MyMonth & "_" & MyDay & "_" & MyYear & ".pdf"
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Sheets(Array("Night Orders", "Master Tank List")).Select
'****
'Generate Adobe File
'****
'**********************************************
'Christina's Adobe printer settings
'**********************************************
Application.ActivePrinter = "Adobe PDF on Ne05:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Adobe PDF on Ne04:", Collate:=True
'****
'Pauses application to provide time for Adobe file to be generated
'****
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 5
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
'****
'Copies Active Night Order to Archive folder (renames file using
current date)
'****
SourceFile = "\\Newellfile\public\Shared\Night Orders\Active Night
Orders\night orders.pdf"
DestinationFile = "\\Newellfile\public\Shared\Night Orders\Archive
Night Orders\" & fName.pdf
FileCopy SourceFile, DestinationFile
Worksheets("Night Orders").Activate
End Sub
called Distribute Sheet. When the user clicks this button the excel
sheet is first converted to a pdf document and then stored on a
network drive. Once this is complete the source file is copied to
another network location and renamed "today's date".pdf. We've been
running this without a problem for months. All of a sudden we've been
receiving the Run Time Error 53 on the FileCopy SourceFile,
DestinationFile line. There have been no changes to the code nor have
there been changes to the users PC. Can someone help me sort this out?
Please see the code below. Any help would be greatly apprecaited.
Thanks
Private Sub cmdDistributeNightOrders_Click()
Dim fName
Dim MyMonth
Dim MyDay
Dim MyYear
Dim SourceFile, DestinationFile As String
MyMonth = Month(Now)
MyDay = Day(Now)
MyYear = Year(Now)
fName = MyMonth & "_" & MyDay & "_" & MyYear & ".pdf"
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Sheets(Array("Night Orders", "Master Tank List")).Select
'****
'Generate Adobe File
'****
'**********************************************
'Christina's Adobe printer settings
'**********************************************
Application.ActivePrinter = "Adobe PDF on Ne05:"
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:= _
"Adobe PDF on Ne04:", Collate:=True
'****
'Pauses application to provide time for Adobe file to be generated
'****
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 5
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
'****
'Copies Active Night Order to Archive folder (renames file using
current date)
'****
SourceFile = "\\Newellfile\public\Shared\Night Orders\Active Night
Orders\night orders.pdf"
DestinationFile = "\\Newellfile\public\Shared\Night Orders\Archive
Night Orders\" & fName.pdf
FileCopy SourceFile, DestinationFile
Worksheets("Night Orders").Activate
End Sub