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
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