Contol of Error

TellM1955

New Member
Joined
Apr 8, 2021
Messages
25
Office Version
  1. 2016
Platform
  1. Windows
  2. Mobile
Hi guys
I have a macro that writes to a pdf and a save box pops up, if I save the file the macro contirues. However, if I don't want to save and cancel the operation I get a Runtime error '1004' Printout of Object 'Sheets' Failed message.
What I would like to do is just continue with the macro when Cancel is pressed. Any help would be greatly appreciated.
Thanks
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Have you tried putting:
VBA Code:
Application.DisplayAlerts = False
before your code and then
VBA Code:
Application.DisplayAlerts = True
after your code??
You could also create your own pop box to "simulate"the choice given to the user by EXCEL
 
Upvote 0
I would suggest that you post your macro code. My signature block below has more about doing that.
 
Upvote 0
Before the Save dialog put the following:
VBA Code:
On Error Resume Next
 
Upvote 1
Solution
Thank you for the responses. The On Error solution worked.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,954
Members
449,096
Latest member
Anshu121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top