If no default printer Open Print Diablog box

G

Gerard Sanchez

currently I have this code. What keeps happening is that whenever
a user goes to a computer where their is no default printer, the print goes
automatically to Save As dialog box.

Is there a way to make it so that the Save As diablog box doesn't pop up.
The Print Dialog box pops up instead so that users can choose which printer
to print from.

Can someone add those VBA for me??


If IsNumeric(Range("F65")) = True And Range("F65") > 0 And _
Range("G59") = "SAN BRUNO CABLE TV" And _
Range("F64") <> "SELECT USER" And _
WorksheetFunction.CountA(Range("C61"), _
Range("C62"), Range("F61"), Range("F62"), _
Range("I61"), Range("I62")) = 1 Then

Range("A18:I69").PrintOut Copies:=1

End if
 
O

OssieMac

The following is untested because I don't know how you can have no default
printer if printers are actually connected to the computer. However, it might
point you in the right direction.

You could use the following code to to find out what value (if any) is
returned if no default printer.

MsgBox Application.ActivePrinter

Then use code similar to the following where I have just assumed that if no
default printer it will return a zero length string.

If Application.ActivePrinter = "" Then
Application.Dialogs(xlDialogPrint).Show
End If

Also you can use the following and simply set the required printer before
printing.

Application.ActivePrinter = "Brother HL-1430 series on Ne02:

Note that you need to properly identify the printer name with follwoing code
when the printer has been set as the default printer for the computer.
MsgBox Application.ActivePrinter
 
G

Gerard Sanchez

'This is exactly what I was looking for!

If Application.ActivePrinter = "" Then
Application.ActivePrinter = "Brother HL-1430 series on Ne02:

End if
End sub

'Thank you OssieMac
"--Gerard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top