**EDITTED - thought id did it in the first place**
I am looking a spreadsheet with userform to print labels.
I am looking at the same spreadsheet but the label printers are of three make and therefore have 3 different name. I am looking at using the Computer Name to pick the correct print name. Also looking at displaying the Computer Name on the Userform
Code so far
I think this should work but when tested no it didnt.. Please Help... Where am I going wrog?![]()
Private Sub frmLABELS_Initialize() Dim strHostName As String strHostName = Environ("ComputerName") . . . . Label9.Caption = strHostName.Value End Sub ------------------------------------------------------------------------------- Private Sub cmdMORE_Click() . . . . Dim strDefaultPrinter As String Dim strLabelPrinter As String If strHostName = "NSHxxxxx1" Then strLabelPrinter = "ZDesigner GK420t" ElseIf strHostName = "NSHxxxxx2" Then strLabelPrinter = "ZDesigner TLP 2844" ElseIf strHostName = "NSHxxxxx3" Then strLabelPrinter = "Zebra TLP2844" Else: strLabelPrinter = Application.ActivePrinter End If Worksheets("Sheet1").Range("B10") = frmLABELS.cboCLINIC.Value Sheets("Sheet1").Range("A1:B4").PrintOut ActivePrinter:=strLabelPrinter, Copies:=txtNO.Value Application.ActivePrinter = strDefaultPrinter End Sub
Bookmarks