Thank you Ron,
I have tryed doing as you instructed, but it doesent print, do you know what
I have done wrong?
Thank you in advance.
BR
Mia
Sub menyskrivoffert()
'
' menyskrivoffert Makro
Sheets("Offert MF").Select
Dim str As String
Dim strNetworkPrinter As String
str = Application.ActivePrinter
strNetworkPrinter = GetFullNetworkPrinterName("\\Server01\NRG DSc428 PCL
6 Färg på Ne07:")
If Len(strNetworkPrinter) > 0 Then
Application.ActivePrinter = strNetworkPrinter
ActiveWindow.SelectedSheets.PrintOut Copies:=1
End If
Application.ActivePrinter = str
Sheets("Meny").Select
End Sub
Function GetFullNetworkPrinterName(strNetworkPrinterName As String) As String
Dim strCurrentPrinterName As String, strTempPrinterName As String, i As
Long
strCurrentPrinterName = Application.ActivePrinter
i = 0
Do While i < 100
strTempPrinterName = strNetworkPrinterName & " on Ne" & Format(i,
"00") & ":"
On Error Resume Next ' try to change to the network printer
Application.ActivePrinter = strTempPrinterName
On Error GoTo 0
If Application.ActivePrinter = strTempPrinterName Then
GetFullNetworkPrinterName = strTempPrinterName
i = 100 ' makes the loop end
End If
i = i + 1
Loop
Application.ActivePrinter = strCurrentPrinterName ' change back to
the original printer
End Function
"Ron de Bruin" skrev: