Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Disable word's save toolbar button and file menu button
Message
De
21/03/2001 12:42:13
 
 
À
20/03/2001 12:50:24
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00485474
Message ID:
00487289
Vues:
22
Hi Dan,
Thanx for getting involved. I would like to look at a program to extract all Word option numbers and prompts.

Thanx
Dr. G. (Neil)

>Neil:
>
>If you create documents from a template, you can take advanatage of the AutoOpen macro to disabled unwanted options.
>
>In the example below, AutoOpen disabled unwanted options listed in the IsTRepNarrOption function.
>
>I can send you a program to extract all Word option numbers and prompts if you need one. Just give me a day to bring it from home.
>
>
>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
>
>
>
>There are some issues regarding the existence of the template but there are several alternatives to reduce the risks of an unwanted option being selected.
>
>Hope it helps,
>
>Daniel
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform