Search code examples
vbavisiovisio-2010

Run-time error '-2032465766 (86db089a)' "Requested operation is presently disabled."


This is weird. Why does Visio throw exception?

Scenario:

  1. Open new instance of Visio.
  2. Press CTRL+N for a blank new document.
  3. Goto VB editor.
  4. Open the default "ThisDocument" code file.
  5. Paste the following code.

    Sub test()
        Application.ActiveWindow.SelectAll
    End Sub
    
  6. 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?


Solution

  • 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.