I have a VBA macro that is called from a spreadsheet function (user-defined function, UDF). When the spreadsheet is downloaded from the Internet, and the user has set the Trust Center settings accordingly, the spreadsheet will open with the so-called "Protected View". The function will not be called. The "Enable Editing" button is displayed. If the button is pressed, the spreadsheet is βtrustedβ and resumes normally, starting the calculation and, therefore, invokes a user-defined function.
However, in this VBA function, the value Application.ActiveWorkbookis equal Nothing. This can be checked in the debugger.
Since I just need to read some properties (such as the path name) of the spreadsheet, I could also check the availability Application.ActiveProtectedViewWindow, which should reference a protected version of the workbook. You can check this object in the debugger. However, when launched in a release (without debugging), the value is Application.ActiveProtectedViewWindowalso equal Nothing.
Both behaviors β especially the first β seem to be a bug in Excel 2010 and 2013 (see also the post on the MSDN forum ).
Question : Is there a way to access the properties of the active book after it has been enabled for editing?
PS: Siddharth Rout, "ThisWorkbook" : . UDF XLA. , ThisWorkbook XLA. ActiveWorkbook (= , UDF) ThisWorkbook (= UDF).
: