Blank page in Print Preview bug identified and reproduced
I noticed this problem for a long time now and I found a way to reproduce it as follow. It is clearly an Excel bug that corrupts the file.
- Open a virgin file, add a second tab (sheet2) if not already there and save the file as and xlsb file (binary).
- On sheet2, define a print area in which your enter something.
- Open VB Project and set up visible property of sheet1 to xlSheetVeryHidden.
- Save the file, close it and reopen it.
When you try to print sheet2, the print preview shows a blank page. See the file TestError1 attached. The bug only appears only if the 1st tab (sheet1) is setup with xlSheetVeryHidden, not any sheet.
There is also another way to reproduce the bug with xlSheetHidden if the file is saved by macro within the event Workbook_BeforeClose in which sheets1 is activated after having been setup to visible=xlSheetHidden. See File TestError2 attached.
Other configurations leads to this bug, see file Test Error Blank Page.
When this bug occurs, the blank page is not the only symptom as you will notice that it is
- Impossible insert new sheet
- Impossible to copy cells to another workbook with this message "this command can not be used on multiple selections."
- Impossible to move the sheets in the tab bar
- Impossible to delete sheets (only by macros)
So the problem is a combination of 3 things : visible property, sheet activation and the way the file is saved (manually or by macro). Hope this will help to resolve the bug which occurs with any version of Excel later then Office 2016 on any OSX but not on PC nor with Mac Office 2011.