This is weird. Why does Visio throw exception?
Scenario:
- Open new instance of Visio.
- Press CTRL+N for a blank new document.
- Goto VB editor.
- Open the default "ThisDocument" code file.
Paste the following code.
Sub test() Application.ActiveWindow.SelectAll End Sub
Execute the subroutine "test".
You will observe this exception for code line "Application.ActiveWindow.SelectAll":
---------------------------
Microsoft Visual Basic for Applications
---------------------------
Run-time error '-2032465766 (86db089a)':
Requested operation is presently disabled.
---------------------------
OK Help
---------------------------
Does anyone know why?
The error "Requested operation is presently disabled" means literally this - the requested operation is disabled (in menu) at the moment (because it makes no sense).
In your case, you can't do "Select all" because there is nothing to select (you have no shapes). So the command "select all" is disabled.
If you had some shapes on the drawing, this code would run just fine.