For several years, by default, files downloaded from the Internet (www or e-mail) receive the MOTW (Mark of the Web) attribute. After opening the file in Excel, a message asking for permission to open the file appears in the yellow bar. Expressing consent removes the MOTW attribute. The file initially opened in Protected View is reopened in "Normal Mode". At this point, when the Workbook_Open event is programmed, an error may occur because the engine does not "see" the properties and methods of the application yet. This is an issue that has been confirmed by MS. Therefore, it is recommended to use a structure similar to the following. Suppose we originally had a procedure:
After the change, it should look like this:
In my opinion, the order of calling procedures in Workbook_Open should be different. First OpenBook, then ShowAllSheets. It will probably require some other minor changes. I can't understand why if you enter the wrong password (or press Cancel) you are asking the user to save the changes. A bad password is to close the file without saving your changes (and without asking). In addition, I believe that the data in the PARAMETERS!I2:L5 range should be encrypted (not only columns J and L, but also I and K) in order not to give the burglar everything on the tray.
You can replace formulas with values by looping through all sheets and by looping through all cells containing formulas. Or, if the formulas are in continuous ranges,
After all the destructive activity, save the file as XLSX. And an XLSM file should commit suicide.
Artik
Bookmarks