Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VB handling on mdi print error code 1004

I am attempting to automatically print an mdi format file from Excel. When
the save menu asks for a name or cancel option, my visual basic program fails
with error code 1004 even though I have an on error statement. How do you
trap the cancel selection from the menu to avoid the vb program from quiting
with an error. When I use the On Error when attempting to print a PDF file
and the user selects cancel, it traps the error and the vb program continues
on to the GoTO address.

Thanks for any help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default VB handling on mdi print error code 1004

When I use the On Error when attempting to print a PDF file and the user
selects cancel, it traps the error and the vb program continues on to the
GoTO address.


Every error handler must have a Resume statement associated with it. So (if
I understand you) when the user cancels your code jumps to your error
handler. In the error handler you have a Goto. That won't fly. Use Resume
instead of the Goto:

On Error Goto ErrHandler
''Potential error causing code
''other code
ResumeHe
''other code
Exit Sub
ErrHandler:
''do stuff
Resume ResumeHere

--
Jim
"Walter L. skinner" wrote in
message ...
|I am attempting to automatically print an mdi format file from Excel. When
| the save menu asks for a name or cancel option, my visual basic program
fails
| with error code 1004 even though I have an on error statement. How do you
| trap the cancel selection from the menu to avoid the vb program from
quiting
| with an error. When I use the On Error when attempting to print a PDF file
| and the user selects cancel, it traps the error and the vb program
continues
| on to the GoTO address.
|
| Thanks for any help.


Reply
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
runtime error code 1004 Karen Excel Worksheet Functions 1 May 13th 10 12:21 AM
Error handling in this code L. Howard Kittle Excel Discussion (Misc queries) 4 October 8th 05 12:35 PM
Repost with code - Runtime error '1004' muziq2[_20_] Excel Programming 5 July 17th 04 12:46 AM
Code Run-time error '1004' pjhageman[_5_] Excel Programming 3 January 11th 04 12:24 AM
VBA code to save gives error 1004??? Richard m Excel Programming 1 November 26th 03 04:10 AM


All times are GMT +1. The time now is 04:03 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"