Dear friends;
I am trying to create an user form for automated printing. I need to insert two combobox objects in a form, one for select the printer and other one to select available paper size for the selected printer.
I already achieve to get installed printers using this code:
Dim nwo As New WshNetwork
Dim i As Integer
Dim j As Integer
Dim bAdd As Boolean
bAdd = True
ImpresoraPlano.Clear
For i = 0 To (nwo.EnumPrinterConnections.Count / 2) - 1
For j = 0 To ImpresoraPlano.ListCount - 1
If nwo.EnumPrinterConnections(i * 2 + 1) < ImpresoraPlano.List(j) Then
ImpresoraPlano.AddItem nwo.EnumPrinterConnections(i * 2 + 1), j
bAdd = False
Exit For
End If
Next j
If bAdd Then ImpresoraPlano.AddItem nwo.EnumPrinterConnections(i * 2 + 1): bAdd = True
Next i
ImpresoraPlano.ListIndex = 2
I can already fill the combobox with installed printers, but I am not being able to fill the second combobox with the available paper sizes for the selected printer. I have already look for solutions here and in other websites, but non code seem to works to me. I am not sure if I need to activate or add any library of object references.
I definitely need help with this.
Thanks in advance