Forum Discussion
Dustion: How to turn OFF/ON Ribbon, formular bar etc ect ??
- Nov 06, 2022
Aargh - I should have seen that. It should be
Private Sub Workbook_BeforeClose(Cancel As Boolean) ActiveWindow.DisplayGridlines = True ...The event is BeforeClose, not Close, and DisplayGridlines is a window property, not an application property.
The Show Gridlines and Show Headings settings are stored in the workbook. Since you change them in the code, Excel sees the workbook as changed, even if you haven't modified any cells.
Aargh - I should have seen that. It should be
Private Sub Workbook_BeforeClose(Cancel As Boolean)
ActiveWindow.DisplayGridlines = True
...
The event is BeforeClose, not Close, and DisplayGridlines is a window property, not an application property.
The Show Gridlines and Show Headings settings are stored in the workbook. Since you change them in the code, Excel sees the workbook as changed, even if you haven't modified any cells.
I wont modify any CELLS in this specific WorkBook because it's only build for manipulating SHAPES, so IF my VBA change of SETTINGS is making the woorkbook DIRTY (=has to be saved) then it wood be better to just SAVE without asking. A user woold be conmfused if it asks for SAVING when he has made no changes !
- HansVogelaarNov 07, 2022MVP
You can remove the lines that set DisplayGridlines and DisplayHeadings. If you save the workbook once when gridlines and headings are hidden, it will remain that way.
Does the marketObjecter macro change anything? If not, your problem should be solved. Since DisplayFormulaBar is an application setting, it does not affect the "dirty" state of the workbook.
Private Sub Workbook_Open() markerObjecter Application.DisplayFormulaBar = False nextPNR = ThisWorkbook.Sheets("NR-Ark").Range("A1") End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) Application.DisplayFormulaBar = True End Sub- keldsorNov 07, 2022Brass ContributorIt work just right as I have it now - thc for your time and advices !