Thank you Roy,
Just deep into CP's code. It should works for me.
Thank you for your assistance.
Thank you Roy,
Just deep into CP's code. It should works for me.
Thank you for your assistance.
Thank you guys.
But my local or online Office Word 2016 would not takes these:
xlDialogPrint
Dim oAcc As Object
Not sure how my Word 2016 would get this one: uses Access's Application object to access the printers
So far I can get Application.activeprinter and Appication.Dialog(wdDialogFilePrintSetup).show
But that only give me the default printer name or manually select a printer by dialog, but not give me name of printers.
Highly appreciated for any help.
Thanks,
I'm redoing an old project was on Wordbasic with macro printings.
What I need is read my installed printers, pick the one I want to use.
I'm testing this codes example from here Retrieve installed printers list from MS.
Sub ShowPrinters()
Dim strCount As String
Dim strMsg As String
'Dim prtLoop As Printer
On Error GoTo ShowPrinters_Err
If Printers.Count > 0 Then
' Get count of installed printers.
strMsg = "Printers installed: " & Printers.Count & vbCrLf & vbCrLf
' Enumerate printer system properties.
For Each prtLoop In Application.Printers
With prtLoop
strMsg = strMsg _
& "Device name: " & .DeviceName & vbCrLf _
& "Driver name: " & .DriverName & vbCrLf _
& "Port: " & .Port & vbCrLf & vbCrLf
End With
Next prtLoop
Else
strMsg = "No printers are installed."
End If
' Display printer information.
MsgBox Prompt:=strMsg, Buttons:=vbOKOnly, Title:="Installed Printers"
ShowPrinters_End:
Exit Sub
ShowPrinters_Err:
MsgBox Prompt:=Err.Description, Buttons:=vbCritical & vbOKOnly, _
Title:="Error Number " & Err.Number & " Occurred"
Resume ShowPrinters_End
End Sub
Display More
and I'm getting basic errors on varies lines;
1) Dim prtloop As Printer (complie error- User-define type not defined)
2) Application.Printers (complie error- Method or data member not found)
I also saw other codes that could do this easily with "application.Printers"
For some reason my environment in Word 2016 only accept application.Printer, not application.Printers!
I know I'm failing something fundamental.
Could someone pointing me what I'm missing?
THANK YOU,
Phi