Here is the code I used, maybe you can scavenge what you need from it. I use Enumerate printers to populate a dropdown box named cbPrinters. Then I use ActivatPrtr to activate the printer the user has selected:
Option Explicit
Const PRINTER_ENUM_CONNECTIONS = &H4
Const PRINTER_ENUM_LOCAL = &H2
Type PRINTER_INFO_1
flags As Long
pDescription As String
PName As String
pComment As String
End Type
Declare Function EnumPrinters Lib "winspool.drv" Alias _
"EnumPrintersA" (ByVal flags As Long, ByVal name As String, _
ByVal Level As Long, pPrinterEnum As Long, ByVal cdBuf As Long, _
pcbNeeded As Long, pcReturned As Long) As Long
Declare Function PtrToStr Lib "kernel32" Alias "lstrcpyA" _
(ByVal RetVal As String, ByVal Ptr As Long) As Long
Declare Function StrLen Lib "kernel32" Alias "lstrlenA" _
(ByVal Ptr As Long) As Long
Function EnumeratePrinters() As String()
Dim ListOfPrinters() As String
Dim Success As Boolean, cbRequired As Long, cbBuffer As Long
Dim Buffer() As Long, nEntries As Long
Dim I As Long, PFlags As Long, PDesc As String, PName As String
Dim pComment As String, Temp As Long
cbBuffer = 3072
ReDim Buffer((cbBuffer \ 4) - 1) As Long
Success = EnumPrinters(PRINTER_ENUM_CONNECTIONS Or PRINTER_ENUM_LOCAL, _
vbNullString, 1, Buffer(0), cbBuffer, cbRequired, nEntries)
If Success Then
If cbRequired > cbBuffer Then
cbBuffer = cbRequired
Debug.Print "Buffer too small. Trying again with " & cbBuffer & " bytes."
ReDim Buffer(cbBuffer \ 4) As Long
Success = EnumPrinters(PRINTER_ENUM_CONNECTIONS Or PRINTER_ENUM_LOCAL, _
vbNullString, 1, Buffer(0), cbBuffer, cbRequired, nEntries)
If Not Success Then
Debug.Print "Error enumerating printers."
Exit Function
End If
End If
Debug.Print "There are " & nEntries & " local and connected printers."
ReDim ListOfPrinters(nEntries - 1)
For I = 0 To nEntries - 1
PFlags = Buffer(4 * I)
PDesc = Space$(StrLen(Buffer(I * 4 + 1)))
Temp = PtrToStr(PDesc, Buffer(I * 4 + 1))
PName = Space$(StrLen(Buffer(I * 4 + 2)))
Temp = PtrToStr(PName, Buffer(I * 4 + 2))
pComment = Space$(StrLen(Buffer(I * 4 + 2)))
Temp = PtrToStr(pComment, Buffer(I * 4 + 2))
Debug.Print PFlags, PDesc, PName, pComment
ListOfPrinters(I) = PName
Next I
Else
Debug.Print "Error enumerating printers."
End If
EnumeratePrinters = ListOfPrinters
End Function
Sub ActivatePrtr()
On Error GoTo Network
Application.ActivePrinter = UserForm1.cbPrinters.Value & " on " & _
GetPrinterDetails(UserForm1.cbPrinters.Value).PortName
Exit Function
Network:
Dim blnWrongNe As Boolean
Dim I As Integer
On Error GoTo Err_Handler
Application.ActivePrinter = UserForm1.cbPrinters.Value & " on " & "Ne00:"
If blnWrongNe Then
blnWrongNe = False
For I = 1 To 9
Application.ActivePrinter = UserForm1.cbPrinters.Value & " on " & "Ne0" & I & ":"
If Not blnWrongNe Then Exit Function
blnWrongNe = False
Next I
End If
Err_Handler:
blnWrongNe = True
Resume Next
End Sub