Use VBA to close Excel File without Prompt (without saving)

Stevenmou

New Member
Joined
Jan 29, 2018
Messages
6
Hi everyone,

I try to use VBA to close an excel file without saving and without prompt.

I've tried many methods below (pasted below) but still cannot do it without the prompt. I figured it was probably because I am in TM1 Perspectives.

Can anyone please help me find a solution?

Thanks a lot,

Rich (BB code):
'tried method 1:
Application.DisplayAlerts = False
ThisWorkbook.Saved = True

'tried method 2:
Application.DisplayAlerts = False
Activeworkbook.Close SaveChanges:=False

'tried method 3:
Application.DisplayAlerts = False
Activeworkbook.close False
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Code:
[COLOR=#454545][FONT=&quot]Sub testSave()[/FONT][/COLOR]
[COLOR=#454545][FONT=&quot]Application.DisplayAlerts = False[/FONT][/COLOR]
[COLOR=#454545][FONT=&quot]ThisWorkbook.Save[/FONT][/COLOR]
[COLOR=#454545][FONT=&quot]Application.DisplayAlerts = True[/FONT][/COLOR]
[COLOR=#454545][FONT=&quot]Application.Quit[/FONT][/COLOR]
[COLOR=#454545][FONT=&quot]End Sub[/FONT][/COLOR]
 
Upvote 0
Thank you for chiming in, however the saving prompt popped up again. I really need some help to skip the saving prompts. Thx
 
Upvote 0
Hi everyone, I found the solution to close a file without prompt as below. Thanks everyone for your help.
Code:
with workbooks(filename)'your file name
.saved =True
.Close
End With
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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