All the Workbook Open event handler should do is a check on whether PV is active or not and raise a flag if PV is active. Of course this should only be done once, but it is not difficult to achieve. This event takes place when PV has ended. This can be accomplished by making the Workbook Activate event handler responsible for this. Nevertheless, it is recommended to wait with the initialization of your application until PV has ended. In addition, unlike before, a semi-ordinary workbook window is now opened simultaneously with the PV window semi-ordinary because the ribbon cannot be used until PV has ended.Īlso my comment that the use of userforms during PV is of no use appears to be outdated. Where previously the use of the Me keyword within the ThisWorkbook module led to run-time errors in PV, regardless of whether the VBE was opened or not, this now appears to be possible (this means that previously PV was terminated at a later stage than I mentioned in my previous post). I must have been caught up in time as I discovered that the implementation of the Protected View (PV) has changed in recent years. Note that use of Userforms (regardless Modal / Modeless) during safe mode is useless.Ĭlick to expand.You are welcome, but I feel compelled to add some additional notes, as my explanation appears to contain some outdated information. Safe mode does not end until the Workbook_Open procedure has completely finished. ThisWorkbook.Sheets(1).Select or ThisWorkbook.Sheets(1).Range("A1").Value = nn) will result in a Run-time error. In safe mode all changes (both manual and programmatically) to the just in protected view opened Workbook are ignored / blocked and such attempts through VBA (eg. ![]() When a Workbook_Open event procedure is running, Excel is keeping that workbook in safe mode. Enabling macros at this point has NOT the effect of immediate quiting protected view and safe mode. ![]() In case the VBE is open on opening of a macro enabled workbook, the second warning consists of a security notice dialog. At the other hand, opening the VBE at this point has the effect of keeping macros disabled so the just opened workbook stays in design mode.Ģ. Pressing this button enables macros and any workbook open event handler present will be invoked. In case the VBE isn't open on opening of a macro enabled workbook, the second warning consists of a yellow bar with a security warning and just one button: "enable content". the VBE is open (your scenario in this thread).ġ. There are two possible scenarios on opening of a being unsafe considered workbook:Ģ. As a personal remark: opening an attachment directly from within your e-mail is never a good idea.Īlthough at the first warning you're enabling editing (and quits from Protected View at the same time), your current macro settings are responsible for the second warning. Note that Excel recognizes the workbook as an e-mail attachment only because of the disk folder to which outlook is extracting the attachments. As mentioned, safe mode's behaviour is dependent on the settings in Trust Center. Safe mode can kick in (among other things) when you open a workbook which is attached to an e-mail. the relationship between the settings of Macro Settings and the settings of Protected View in Excel's Trust Center. ![]() The run-time error can be explained from Excel's safe mode, at least because of the way this safe mode is implemented, i.e.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |