I have previously setup code to print to a network printer for anyone who accesses that spreadsheet. I am not great at Visual Basic, but had pieced together the following code through various sources on the internet.
I had this code working previously, but we have changed servers and when I updated the network printer name to reflect the new server I am getting an apparently valid printer name (the For q = 0 To 99 loop does not go through to 99) but the ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,sPrinterName,,TRUE,,FALSE)" line is not doing anything. Any ideas of what my problem is?
Code:
Sub Summary_print_all()
'
'
Dim q As Long, sPrinterName As String
On Error Resume Next
For q = 0 To 99
sPrinterName = "\\pbivanfp01\Xerox Versant 80 PS on Ne" & Format(q, "00") & ":"
Application.ActivePrinter = sPrinterName
If Err.Number = 0 Then
q = 99
Else
Err.Clear
End If
Next q
On Error GoTo 0
complete = Worksheets("Retrieval").Range("F1")
For Count = 1 To complete
'OTHER MACROS TO PREPARE FOR PRINTING
Application.ActivePrinter = sPrinterName
ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,sPrinterName,,TRUE,,FALSE)"
Next Count
End Sub
I had this code working previously, but we have changed servers and when I updated the network printer name to reflect the new server I am getting an apparently valid printer name (the For q = 0 To 99 loop does not go through to 99) but the ExecuteExcel4Macro "PRINT(1,,,1,,,,,,,,2,sPrinterName,,TRUE,,FALSE)" line is not doing anything. Any ideas of what my problem is?