Make the save question go away!!!

robfo0

Active Member
Joined
Feb 19, 2002
Messages
281
Hi everyone,

I have had this issue before, but i still cant seem to get it to work after some changes. I want the file i am working on NOT to ask the save question. I make it automatically save unless it begins with a certain string. here is my before close code:


Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Left(ThisWorkbook.Name, 6) = "Retail" Then
Application.Run "Delete_code.DeleteSheets"
Else
Application.Run "Navigation.CustomerFileClose"
End If
ThisWorkbook.Saved = True
End Sub


the "Delete_code.DeleteSheets" is run if the file name starts with "Retail", but the "Delete_code.DeleteSheets" module is also ran from the "Navigation.CustomerFileClose" code. I have found the problem but dont know how to fix it. The save question appears only if i use the code which deletes sheets from my workbook. I tried hiding this code, and it works fine. How can i get around this?! thanks very much

Note: after extensive playing with code, i have found that the message only pops up when i delete a specific sheet, the "Navigation" sheet which contains all the code from the file which I am working on. If i delete other sheets, the save question does not pop up... Why would this be? help!!!
This message was edited by robfo0 on 2002-09-04 16:09
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Richie(UK)

MrExcel MVP
Joined
May 17, 2002
Messages
3,329
Hi,

Have you tried:

Application.DisplayAlerts=False

(remember to set to True again after the relevant section of code)

HTH
 

robfo0

Active Member
Joined
Feb 19, 2002
Messages
281
Yes, i have tried doing that, in fact, i do have that code when i delete the sheets so it doesnt ask me to confirm. I tried watching the code run, and the workbook changes to unsaved at the very end of the code before it closes. But, like i said, if i try the code without deleting the "Navigation" sheet, it works. There must be some way around this? (yes i reallly want to delete that sheet)

Any other ideas?

Thanks
 

robfo0

Active Member
Joined
Feb 19, 2002
Messages
281
Does anyone else have any other suggestions regarding this? I'm really in a bind, if the file asks if you want to save the workbook, and a user clicks no, it will corrupt that workbook everytime! Please, ive tried everything i can think of and all suggestions i have found, help!!
 

Forum statistics

Threads
1,143,748
Messages
5,720,625
Members
422,293
Latest member
camillel

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
Top