>Sub AutoOpen() > >'=========================================== >' Disable unwanted tools and menu options >'=========================================== > >SetTRepNarrOptions(wdFalse) > >EndSub > > > >Sub SetTRepNarrOptions(tlEnabled As Boolean) > >' ====================================== >' Loop through the toolbars collection >' and disable unwanted options. >' ====================================== > >Dim loToolBar As CommandBar > >For Each loToolBar In CommandBars > SetToolBarOptions toCommandBar:=loToolBar, tlEnabled:=tlEnabled >Next > >End Sub > > > >Sub SetToolBarOptions(toCommandBar As CommandBar, tlEnabled As Boolean) > >' ====================================== >' Loop through the Controls collection >' and disable unwanted options. >' >' It is necessary to call a similar >' subroutine for submenu because a >' CommandBarControl is not a >' CommandBar. >' ====================================== >Dim loControl As CommandBarControl > >For Each loControl In toCommandBar.Controls > If loControl.Type = msoControlPopup Then > SetControlPopupOptions toControlPopup:=loControl, tlEnabled:=tlEnabled > Else > If IsTRepNarrOption(loControl.ID) Then > loControl.Enabled = tlEnabled > End If > End If >Next > >End Sub > > > >Sub SetControlPopupOptions(toControlPopup As CommandBarControl, tlEnabled As Boolean) > >' --------------------------------- >' Disable all unwanted options. >' >' This subroutine calls itself >' recursively to handle submenus. >' --------------------------------- >Dim loControl As CommandBarControl > >For Each loControl In toControlPopup.Controls > If loControl.Type = msoControlPopup Then > SetControlPopupOptions toControlPopup:=loControl, tlEnabled:=tlEnabled > Else > If IsTRepNarrOption(loControl.ID) Then > loControl.Enabled = tlEnabled > End If > End If >Next > >End Sub > > > >Function IsTRepNarrOption(liId As Integer) As Boolean > >' ==================================== >' Specifies if an option is disabled >' when editing the Tax Representative >' Narrative. >' ==================================== >IsTRepNarrOption = False > >Select Case liId > Case 18, 2520 > ' > ' New > ' --- > ' 18 Menu, 2520 Toolbars > ' > IsTRepNarrOption = True > Case 23 > ' > ' Open > ' ---- > ' > IsTRepNarrOption = True > Case 106 > ' > ' Close > ' ----- > ' > ' IsTRepNarrOption = True > Case 748 > ' > ' Save As > ' ------- > ' Disabled because Atlas expects the Tax Representative > ' Narrative to be saved as TRepNarr.Doc in the same folder > ' where the audit data is stored. > ' > IsTRepNarrOption = True > Case 246 > ' > ' Mail Merge > ' ---------- > ' Disabled because we don't want the user to create a new > ' document. This situation would arise if the user elects > ' to MailMerge to a new document. > ' > IsTRepNarrOption = True > Case 831 > ' > ' Most recent opened documents > ' ---------------------------- > ' Disabled because other documents are not relevant to this process. > ' > ' AtlasOptionAvailable = False > Case 752 > ' > ' Exit > ' ---- > ' Disabled because we want the user to select the "Return to > ' Atlas" option instead. > ' > 'AtlasOptionAvailable = False > Case 797 > ' > ' Customize > ' --------- > ' Disabled because the user could drop new unwanted options > ' on any toolbar. > ' > IsTRepNarrOption = True >End Select > >End Function >>