> On Mon, 15 Dec 2008 14:49:01 -0800, kbaxreno
> <kbaxreno[ at ]discussions.microsoft.com> wrote:
>
> >Hello All.
> >I have adopted a huge application written in Word VBA. There are probably
> >50 custom menus and submenus. I understand VB and have no problem
> >maintaining and updating the code, but I have not figured out how to identify
> >the template and module that is linked to a custom menu without making
> >guesses in the code, installing breakpoints, crossing my fingers and running
> >the apps. Often this takes me a few tries. As I become more familiar with
> >the project my guesses are much better but it seems there must be a better
> >way.
> >
> >Thanks Ahead...
> >Ken
>
> These macros will give you a hint, although they'll still leave you doing some
> poking around.
>
> Sub MacrosOnToolbars()
> Dim oCB As CommandBar
> Dim oCBC As CommandBarControl
> CustomizationContext = NormalTemplate
>
> For Each oCB In CommandBars
> For Each oCBC In oCB.Controls
> On Error Resume Next
> With oCBC
> If Len(.OnAction) Then
> MsgBox .Caption & " uses " & .OnAction
> End If
> End With
> Next
> Next
> End Sub
>
> Sub MacrosOnMenus()
> Dim oCB As CommandBarControl
> Dim oCBC As CommandBarControl
> CustomizationContext = NormalTemplate
>
> For Each oCB In CommandBars("Menu Bar").Controls
> For Each oCBC In oCB.Controls
> On Error Resume Next
> With oCBC
> If Len(.OnAction) Then
> MsgBox .Caption & " uses " & .OnAction
> End If
> End With
> Next
> Next
> End Sub
>
> If the toolbars and menus are stored in some template other than Normal.dot,
> you'll need to change the CustomizationContext to that template.
>
> The message box will tell you the caption (the display in a menu, or the tooltip
> of a toolbar button) and the name of the module and macro that are assigned to
> the command. It won't tell you the name of the template that contains the
> module; and you won't see the module in the VBA editor's project pane if the
> template is a global one. You can see the module names in the Organizer, or you
> can open the global templates through the File > Open command and then view them
> in the VBA editor.
>
>
> --
> Regards,
> Jay Freedman
> Microsoft Word MVP FAQ:
http://word.mvps.org> Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
>