ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   error handling off?? (https://www.excelbanter.com/excel-programming/307471-re-error-handling-off.html)

Tom Ogilvy

error handling off??
 
Look in the VBE on his computer and see what the options (tools=Options)
are for error handling. I suspect he is set to break on all errors.
--
Regards,
Tom Ogilvy

"Kriese" wrote in message
...
In excel vba, i am converting a workbook to a pdf.
To do this i need to change the active printer to that of the adobe pdf
converter.
but for some reason, the name of this printer changes. ie. 'Adobe PDF on
Ne01' to 'Adobe PDF on Ne02'. To deal with this, i loop through ne01 to

ne99
and try to set it to the first one it can. this works fine one my

computer,
my co-workers computer etc. However, there is one co-workers computer

that
it does not work on. We are all using the same newly installed version of
excel 2003. His computer thows an error when it tries to set the active
printer to 'Adobe PDF on Ne01' and does not go to the line as designated

in
On Error goto NextNumber. it is as though it ignors the onerror
command...below is my code. is there any way that he has error checking

OFF?
thank you for your time

printed = false
printerNumber = 1
'look for the active adobe printer, changes on every restart
While printed = False And printerNumber <= 99

If printerNumber 9 Then
On Error GoTo nextNumber
Application.ActivePrinter = "Adobe PDF on Ne" &
printerNumber & ":"
Else
On Error GoTo nextNumber
Application.ActivePrinter = "Adobe PDF on Ne0" &
printerNumber & ":"
End If
printed = True
'print out on the active printer
ActiveWorkbook.PrintOut Copies:=1, Collate:=False
nextNumber:
printerNumber = printerNumber + 1
Wend





All times are GMT +1. The time now is 09:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com