Macro crashes if printer not installed

  • Thread starter Thread starter Phil
  • Start date Start date
P

Phil

I am using the following code to add a footer to a page:

ActiveSheet.PageSetup.RightFooter = "&8&F" & Chr(10) & "&A" & Chr(10) &
"&D"

The problem is that the macro crashes on a computer that does not have
a printer installed. Can anyone please suggest a way to handle this?
 
You can assign/configure a print driver even though you don't actually
connect a printer to the computer. You then select that in your print
setup.
 
I don't have a machine without a printer driver, so I can't test it, but you
could try wrapping it with error handling

On Error Goto no_printer
...

no_printer:
Msgbox "No printer installed"
 

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

Back
Top