Exit without save from a read only version of a file

UKPhil

New Member
Joined
Jul 25, 2002
Messages
49
HI all, I Have a macro which opens a file, extracts different data depending on the day of the week then closes it without saving the changes, I have screen alerts turned off. However if someone else is using the file at the time, the macro opens a read only version, when It then tries to close the file it stops and offers to 'save as' the file to another location. Seems the line ActiveWindow.Close SaveChanges = False
won't work on this occasion. Anyone know of a workaround?
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Try ActiveWorkbook.Close instead of ActiveWindow.Close or:

Code:
If Not ActiveWorkbook.ReadOnly Then
    ActiveWindow.Close SaveChanges = False
End If
 
Upvote 0

Forum statistics

Threads
1,203,534
Messages
6,055,954
Members
444,839
Latest member
laurajames

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