#1
|
|||
|
|||
Problems with ThisWorkbook.Saved not working ?
I have a workbook with few sheets in it.
I the beforeClose I use ThisWorkbook.Saved to show a enhanged dialog explaining in danish the situation for the user - it's just the normal problematic ... do you want to save or not or cancel then close the file - here is the code: Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean) ' Application.DisplayFormulaBar = True ' ActiveWindow.Zoom = initZoom ' ActiveSheet.Range("A1").Select ' Dim svar As Byte If ThisWorkbook.Saved = False Then svar = MsgBox("Du har lavet ændringer på et af arkene - bevidst eller ubevidst !" & vbLf & vbLf & _ "Er du USIKKER på, hvad du har lavet --> så svar NEJ til at gemme !" & vbLf & vbLf & _ "Overvej nøje HVAD du har lavet, og besvar så dette: 'Vil du gemme ?'", _ vbYesNoCancel + vbDefaultButton2, "ADVARSEL <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<") If svar = vbYes Then ThisWorkbook.Save ElseIf svar = vbNo Then ThisWorkbook.Saved = True ElseIf svar = vbCancel Then Cancel = True End If End If End Sub How can I find out where the chance happens ? |
#2
|
|||
|
|||
OK, it seems like I change something in the opening:
Code:
ActiveWindow.DisplayGridlines = False Application.DisplayFormulaBar = False ActiveWindow.DisplayHeadings = False ... but I don't think this have to do with anything in the FILE it's Excel settings - right ? Last edited by ksor; 07-12-2023 at 09:51 PM. |
Tags |
excel 2019, vba code |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Track changes saved to pdf with only red vertical lines saved | peterm | Word | 4 | 09-16-2020 07:37 PM |
Problems with Outlook: secure settings no longer working | AlanC | Outlook | 1 | 07-06-2018 05:03 AM |
Two problems, maybe related: c/paste not working, Word won't delete | Feeb63 | Word | 2 | 03-14-2015 05:33 PM |
Video not working when saved as .ppt But does when saved as .pptx | patientxwolf | PowerPoint | 5 | 01-24-2014 02:16 PM |
Problems working in a partially protected document | Autumn | Excel | 0 | 02-11-2009 03:46 PM |