Wilder1626
asked on
Add printer path to a text box
Hello all,
I need to fix this code about setting.
I need to be able to select and save a printer by default.
For that, i want to save the printer path to the text3.
How can i do this please?
Thanks again.
I need to fix this code about setting.
I need to be able to select and save a printer by default.
For that, i want to save the printer path to the text3.
How can i do this please?
Thanks again.
CommonDialog1.FileName = App.Path
CommonDialog1.ShowPrinter
Text3.Text = CommonDialog1.Printer
ASKER
It's because i have 3 printers. I need to be able to change it from time to time.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I will try it.
I'll be back with the result.
Thanks
I'll be back with the result.
Thanks
ASKER
Good,
I will use this one. It work perfectly like this.
Thanks again for your help.
I will use this one. It work perfectly like this.
Thanks again for your help.
ASKER
I forgot to put the code.
Private Sub cboPrinters_Click()
Dim i As Integer
Dim p As Printer
For Each p In Printers
If i = cboPrinters.ListIndex Then
Set Printer = p
Exit For
End If
i = i + 1
Next p
Label1.Caption = Printer.DeviceName
End Sub
Private Sub Form_Load()
PopulatePrinters
End Sub
Private Sub PopulatePrinters()
Dim p As Printer
Dim i As Integer
i = 0
For Each p In Printers
cboPrinters.AddItem p.DeviceName
If p.DeviceName = Printer.DeviceName Then
cboPrinters.ListIndex = i
End If
i = i + 1
Next p
End Sub
I see from your comment that you were not satisfied with my answer. I didnt thought you would need the whole code. I think i anwered your question and gave you a solution which lead you to the final one.
Its not fair to close it like that but if its your decision the fine ...
Thanks anyway
Its not fair to close it like that but if its your decision the fine ...
Thanks anyway
ASKER
Sorry, i did give you points for this.
Let me try again.
Let me try again.
ASKER
Sorry, for this. I dont no why the points didnt transfert to you.
Sorry again.
Sorry again.
No problem man. The question was in closing mode ...maybe you did that by mistake.
Thank you
Thank you
good morning!
have u try something like this...
CommonDialog1.PrinterDefau
this will set the default printer..
game-master