Private Sub ProcessMenuItems(ByVal objMenuItems As Menu.MenuItemCollection, ByVal strMenuPath As String) '************************************************************************ ' Procedure/Function: ProcessMenuItems() ' Author: Ben Santiago ' Last Revision: 05/25/2006 ' Description: ' This routine process each menu item in the supplied collection, ' storing it's MenuText into an internal array and recursivly calling ' itself in order to process any child menu items that may be present. ' ' Structure: ' MenuName|MenuText|MenuText|Etc... ' ' MenuName ' MenuText ' MenuText ' Etc... '************************************************************************ '*************************************** ' Initialize Variables '*************************************** Dim objCurrentItem As MenuItem Dim intCurrentItem As Short Dim strCurrentMenuPath As String '*************************************** ' Process Each Menu Item '*************************************** For intCurrentItem = 0 To (objMenuItems.Count - 1) '*************************************** ' Initialize Values Used For Loop '*************************************** objCurrentItem = objMenuItems(intCurrentItem) If strMenuPath <> "" Then If objCurrentItem.Text = "-" Then strCurrentMenuPath = strMenuPath & "|----------" Else strCurrentMenuPath = strMenuPath & "|" & objCurrentItem.Text End If Else strCurrentMenuPath = objCurrentItem.Text End If '*************************************** ' Remove Single Ampersands (&) From String '*************************************** strCurrentMenuPath = strCurrentMenuPath.Replace("&&", Chr(240)) strCurrentMenuPath = strCurrentMenuPath.Replace("&", "") strCurrentMenuPath = strCurrentMenuPath.Replace(Chr(240), "&") '*************************************** ' Add Menu Item Name '*************************************** strCurrentMenuPath = objCurrentItem.Name & "|" & strCurrentMenuPath '*************************************** ' Store The Current Menu Item "Path & Text" Into The Array '*************************************** Me._arrMenuStructure.Add(strCurrentMenuPath) '*************************************** ' If Current Menu Item Has Children, Call This Method Recursively '*************************************** If objCurrentItem.MenuItems.Count > 0 Then Me.ProcessMenuItems(objCurrentItem.MenuItems, strCurrentMenuPath) End If Next End Sub