LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default error trapping

Thanks guys!
-----Original Message-----
On Error goto ErrHandler
Application.ActivePrinter = listbox1.value
Exit Sub
ErrHandler:
msgbox err.number & vbNewLine & _
err.Description & vbNewline & vbNewLine & _
"This printer is not available"
End Sub

--
Regards,
Tom Ogilvy



libby wrote in

message
...
Hi

Well, there are many networked printers in our office

and
I have created a form which has 5 of the most common

ones
in it. When the user selects one, a label displays the
location of the printer in the office.
I've also so set it so that if the Active Printer for a
particular pc isn't in the listbox, then it's added to

it.

There is a "Change" button on the form which changes the
active printer to one which the user has selected.

It all works fine if you have all the printers mapped to
your pc, but if you try and change the active printer to
one which is not mapped to your pc, then the run-time
error occurs.
I need to either map the printer (which I don't think is
possible)
or trap this error and go to an error handler which
displays an appropriate message.

The code for the Change button is
Application.ActivePrinter = listbox1.value

I can post more code if need be, but don't have it to

hand
at present.

-----Original Message-----
post all of your code relating to this

--
Don Guillett
SalesAid Software

"libby" wrote in

message
...
Hi
I'm having real trouble trapping this error.

I have a sub where the active printer is changed
Application.ActivePrinter = ListBox1.value

if the printer is networked then it works fine, but

if
it
isn't I get a run-time error 1004
Method 'ActivePrinter' of object'_Application' failed

Is there any way I can user On Error GoTo

Errorhandler
to
display the message "Printer Not Mapped" if this

happpens?

Thanks in advance
Libby (xl97)


.



.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Trapping gazza67[_2_] Excel Discussion (Misc queries) 2 September 6th 07 06:11 PM
Trapping #VALUE! error RhysPieces Excel Discussion (Misc queries) 6 August 22nd 07 03:13 AM
Error Trapping from WSH Tom Chau Excel Discussion (Misc queries) 1 August 25th 06 04:21 AM
error trapping flow23 Excel Discussion (Misc queries) 3 April 13th 06 04:51 PM
Remind me to set Error Trapping to Break on Unhandled Errors don Excel Programming 0 November 5th 03 06:06 PM


All times are GMT +1. The time now is 11:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"