Menus

C

calvinX

Hi All,

I have a question, hopefully it is a simple one.

Ho do I call some metods in a class object that is in a VISIO 2002 add-in
that I am building (VS.NET). I am going to be adding a custom menu and
would like to know how I can reference these methods. When I had the code
stored in the document I used MODULE_NAME.FUNCTION_NAME.

Any help would be great, here is the code:

Private Sub AddDocumentMenu()
On Error Resume Next
'Attach new menu to Visio.
Dim uiObj As UIObject 'contains the UI object for this instance of Visio
Dim MenuSetsObj As MenuSets 'MenuSets collection
Dim MenuSetObj As MenuSet 'A MenuSet object
Dim MenusObj As Menus 'Menus collection
Dim MenuObj As Menu 'A Menu object
Dim MenuItemsObj As MenuItems 'MenuItems collection
Dim MenuItemObj As MenuItem 'A MenuItem object
Dim strMenuAction As String

uiObj = AppVisio.BuiltInMenus
MenuSetsObj = uiObj.MenuSets
MenuSetObj = MenuSetsObj.ItemAtID(visUIObjSetDrawing)

'Put a single menu into this set
MenusObj = MenuSetObj.Menus
MenuObj = MenusObj.AddAt(6)
MenuObj.Caption = "&Draw Actions"
MenuItemsObj = MenuObj.MenuItems
MenuItemObj = MenuItemsObj.Add
MenuItemObj.Caption = "Point &List Fill"
strMenuAction = "Custom_Functions.ListFill"
MenuItemObj.AddOnName = strMenuAction
MenuItemObj.MiniHelp = "Fill selected points list"
MenuItemObj.ActionText = "Fill selected points list"

'<<<<<<<<<SEPERATOR
MenuItemObj = MenuItemsObj.Add
MenuItemObj.CmdNum = 0

'<<<<<<<<<VERIFY LAYERS
MenuItemsObj = MenuObj.MenuItems
MenuItemObj = MenuItemsObj.Add
MenuItemObj.Caption = "&Verify Document Layers"
strMenuAction = "Custom_Functions.VerifyPageLayers"
MenuItemObj.AddOnName = strMenuAction
MenuItemObj.MiniHelp = "Verify correct layers are present on each page"
MenuItemObj.ActionText = "Verify correct layers are present on each page"

' Change the current menus to the custom one
AppVisio.SetCustomMenus(uiObj)
End Sub
 
M

Michael J. Hunter

The place to start is Developing Microsoft Visio Solutions on MSDN
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devref/HTM
L/DVS_23_Using_COM_Add-ins_in_a_Visio_solution_1038.asp).


Michael J. Hunter
Microsoft
michhu-at-online-dot-microsoft-dot-com

Developing Microsoft Visio Solutions:
http://msdn.microsoft.com/library/en-us/devref/HTML/DVS_Copyright_1270.asp
Developer Resources for Microsoft Visio:
http://msdn.microsoft.com/library/default.asp?url=/nhp/Default.asp?contentid=28000456

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top