Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
HELP: how to detect if printers are installed? woes :S
I made a Excel template with a macro to set up page margins, etc for the
printer. This macro is ran when you load up the Excel template. However, if once doesn't have any printers installed, they get a warning to chose/find/setup a printer. Does anyone know in VBA how to detect whether any printers are installed. If no printer is installed then bypass my printer setup code? |
#2
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
|
|||
|
|||
HELP: how to detect if printers are installed? woes :S
Hi
An error message is generated when you try and print with no printer. I Googled this group and found this code from Tom Ogilvy which you might be able to adapt. I don't know how you catch the error without trying the print though - maybe some kind of test print when the user first tries to use your code, which then gives a warning if no print possible? Sub PrintInvoice() Dim Res As Long Res = MsgBox("Do you want to print the invoice?", vbQuestion + vbYesNo) Select Case Res Case vbYes On Error Resume Next ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True if err.Number < 0 then _ MsgBox "Error: " & err.Description, vbOK + vbInformation Err.clear On Error goto 0 Case vbNo Exit Sub End Select End Sub regards Paul KevinGPO wrote: I made a Excel template with a macro to set up page margins, etc for the printer. This macro is ran when you load up the Excel template. However, if once doesn't have any printers installed, they get a warning to chose/find/setup a printer. Does anyone know in VBA how to detect whether any printers are installed. If no printer is installed then bypass my printer setup code? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
HELP: how to detect if printers are installed? woes :S | Excel Worksheet Functions | |||
Printers | Excel Programming | |||
list o installed printers | Excel Programming | |||
Detect what version (if any) of Excel is installed | Excel Programming | |||
Printers & LPT | Excel Programming |