When Closing a workbook by Macro I get a "Save' message requiring I answer...

mmercerjdcpa

New Member
Joined
Mar 22, 2006
Messages
2
OK Folks, this one should be easy for you...

In the macro below, I am closing the workbook zzzJobReport.xlsx.
The Macro pauses and the box comes up:
"Do you want to save the changes you made...?" requiring me to answer Yes or No.
I always want to answer 'No' but want to do it in the Macro.

Tried to record it but it does not give me the info.

Question: How do I either 1st, set a parameter to not save the Workbook, or
2nd, Answer the question that comes up on the screen: "No' but inside the Macro?

Here's the code:
' Job Report:
Workbooks.Open Filename:="C:\CookStreetAllocation\zzzJobReport.xlsx"
Cells.Select
Selection.Copy
Windows("Allocation of COGS.xlsm").Activate
Sheets("Job Report").Select
Cells.Select
ActiveSheet.Paste
Application.CutCopyMode = False
Windows("zzzJobReport.xlsx").Close
Range("A1").Select

Thanks in advance for your help!!

Marty
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Change this:
Code:
Windows("zzzJobReport.xlsx").Close
to this:
Code:
Windows("zzzJobReport.xlsx").Close SaveChanges:=False
or:
Code:
Workbooks("zzzJobReport.xlsx").Close SaveChanges:=False
Denis
 
Upvote 0
Change this
Code:
Windows("zzzJobReport.xlsx").Close
to this
Code:
Workbooks("zzzJobReport.xlsx").Close False
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,287
Members
452,902
Latest member
Knuddeluff

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