Default Printer VBA CODE

VQCHEESE

Board Regular
Joined
Aug 28, 2006
Messages
161
Right now i have it harcoded in for a specific printer, and this is my code

Application.ActivePrinter = "\\VQ1\HP Color LaserJet 4730mfp PCL 6 on Ne03:".

Can someone help me on code so after Application.ActivePrinter = I want it to code in so it just takes the deafault printer. Thanks
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Joe

All I want to do is have it grab the default printer and print. I dont want to do any switching or have any msg box come up. Please Help

Thanks
Brian
Valley Queen Cheese
 
Upvote 0
This will display the active printer name and give you the option of selecting a new printer from the list of installed printers.

Sub showSelPDialog()
'Run from Standard Module, like: Module1.
Dim selPrinter As Boolean, pResp As Boolean
Dim activPNm$, pMsg$, pStyle$, pTitle$

activPNm = Application.ActivePrinter
pMsg = "You currently print to:" & vbLf & vbLf & _
activPNm & vbLf & vbLf & _
"Do you want to select a different printer?"
pStyle = vbYesNo + vbInformation + vbDefaultButton2
pTitle = "Get Printer?"

pResp = MsgBox(pMsg, pStyle, pTitle)

If pResp = True Then
selPrinter = Application.Dialogs(xlDialogPrinterSetup).Show

If (selPrinter = True And activPNm <> Application.ActivePrinter) Then
MsgBox "You will now Print to:" & vbLf & vbLf & _
Application.ActivePrinter
End If
End If
End Sub

And, this will print using the currrent printer:

Sheets("Sheet1").PrintOut
 
Last edited:
Upvote 0
hi all friends , plz help i hve Excel file micro ,,,,,,,
i hve 2 printer attach with pc , 1 laser jet 1320 and thermal , Dpp250
i want POS sheet only print with thermal printer else other all dicoment print on Hp
if thermal off , notify me
 
Upvote 0

Forum statistics

Threads
1,213,521
Messages
6,114,104
Members
448,548
Latest member
harryls

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top