To use Visio object model from a .NET application, you need to add a reference to Visio type library to that application. This is Microsoft.Office.Interop.Visio
. You could start over in the Microsoft documentation: https://learn.microsoft.com/en-us/visualstudio/vsto/visio-object-model-overview
The global VBA objects, like ActiveWindow
, are available as app.ActiveWindow
(assuming the "app" is the root Visio Application object you access). In case of an Add-In:
var w = Globals.ThisAddIn.Application.ActiveWindow
or in case you need to access from a method of the add-in:
var w = Application.ActiveWindow
Enumerations should be prefixed with its type: VisSectionIndices.visSectionAction
.
Please note that the answer in the linked question explains how to add a menu item to a shape, not to the application. If you want to extend application menu rather than shape menu (?), you need to add your menu item to the ribbon definition.