Hello all,
I am trying to figure out why this code is not working properly on my bosses computer, but works just fine off of my computer. The file is located on a shared drive, so I am not understanding why. Don't know if anyone has ever experienced this at their work place before, if so, your assistance would be greatly appreciated.
Attached is the VBA I use to print a worksheet. It will ask what printer the user would like to use and the default on both our machines is the same.
It throws a runtime error of 1004 on this line - Application.ActivePrinter = "\\wshps4\ghcolor on Ne03:"
Here goes:
Sub PrintSheet1()
Dim Answer As String
Dim Response As Integer
Answer = "Do you want to print in color?"
Response = MsgBox(Answer, vbQuestion + vbYesNoCancel, "???")
If Response = Cancel Then Exit Sub
If Response = vbYes Then
Copies = Application.InputBox("How many copies do you wish to print?", Type:=1)
If Copies < 1 Then Copies = 1
Sheets("Employee Hours Week2").Select
Range("A2:h41").Select
Application.ActivePrinter = "\\wshps4\ghcolor on Ne03:"
ActiveWindow.Selection.PrintOut Copies:=Copies, Collate:=True, ActivePrinter:="\\wshps4\ghcolor on Ne03:"
Else
If Response = vbNo Then
Answer = "Do you want Black and White copies?"
Response = MsgBox(Answer, vbQuestion + vbYesNo, "???")
If Response = vbNo Then Exit Sub
If Response = vbYes Then
Copies = Application.InputBox("How many copies do you wish to print?", Type:=1)
If Copies < 1 Then Copies = 1
Sheets("Employee Hours Week2").Select
Range("A2:h41").Select
Application.ActivePrinter = "\\WSHPS4\A066 on Ne02:"
ActiveWindow.Selection.PrintOut Copies:=Copies, Collate:=True, ActivePrinter:="\\WSHPS4\A066 on Ne02:"
End If
End If
End If
End Sub
Bookmarks