OL2000: How to Prevent Changes to the Outlook Bar

ID: Q222396


The information in this article applies to:
  • Microsoft Outlook 2000


SUMMARY

This article describes how you can use Visual Basic for Applications to prevent the Outlook Bar from being changed.


MORE INFORMATION

Organizations sometimes may want to prevent individual users from making changes to program or system settings. Using the Microsoft Office 2000 Custom Installation Wizard, you can deploy a custom set of Outlook Bar shortcuts for users in an organization, but there is no direct way to prevent users from modifying those shortcuts after Outlook has been deployed.

You can use the following Visual Basic for Appications code as a basis for creating a solution, typically in the form of an Outlook COM Add-in, that will limit the user's ability to make changes to the Outlook Bar.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Solution Provider or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Solution Providers, please see the following page on the World Wide Web:

http://www.microsoft.com/mcsp/
For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

http://www.microsoft.com/support/supportnet/refguide/
For additional information about how to manage Outlook Visual Basic for Applications projects, please see the following article in the Microsoft Knowledge Base:
Q229911 OL2000: Managing and Distributing Outlook VBA Projects
NOTE: If you are already using Visual Basic for Applications code in Outlook, quit Outlook and rename the VbaProject.otm file to start off with a new project.

To limit the user's ability to make changes to the Outlook Bar, follow these steps:
  1. On the Tools menu, point to Macro, and then click Visual Basic Editor.


  2. In the Project Explorer pane, expand Project1 to show entries below it, and then expand Microsoft Outlook Objects to show entries below that. Double-click the ThisOutlookSession module to open the code window.


  3. Add the following Visual Basic for Applications code to the ThisOutlookSession module:


  4. 
    Dim WithEvents oPane As OutlookBarPane
    Dim WithEvents oGroups As OutlookBarGroups
    Dim WithEvents oShortcuts As OutlookBarShortcuts
    
    Private Sub Application_Startup()
       Set oPane = ActiveExplorer.Panes(1)
       Set oGroups = oPane.Contents.Groups
       Set oShortcuts = oPane.CurrentGroup.Shortcuts
    End Sub
    
    Private Sub oGroups_BeforeGroupAdd(Cancel As Boolean)
       MsgBox "Sorry, you cannot add a group to the Outlook Bar."
       Cancel = True
    End Sub
    
    Private Sub oGroups_BeforeGroupRemove _
          (ByVal Group As OutlookBarGroup, Cancel As Boolean)
       MsgBox "Sorry, you cannot remove a group from the Outlook Bar."
       Cancel = True
    End Sub
    
    Private Sub oPanes_BeforeGroupSwitch _
          (ByVal ToGroup As OutlookBarGroup, Cancel As Boolean)
       Set oShortcuts = ToGroup.Shortcuts
    End Sub
    
    Private Sub oShortcuts_BeforeShortcutAdd(Cancel As Boolean)
       MsgBox "Sorry, you cannot add a shortcut to the Outlook Bar."
       Cancel = True
    End Sub
    
    Private Sub oShortcuts_BeforeShortcutRemove _
          (ByVal Shortcut As OutlookBarShortcut, Cancel As Boolean)
       MsgBox "Sorry, you cannot delete a shortcut from the Outlook Bar."
       Cancel = True
    End Sub 
  5. Restart Outlook.


With the this code running while the user is working in Outlook, the user will not be able to make changes to the Outlook bar. However, the user will still be able to rename shortcuts and groups on the Outlook Bar; there is no way to disable the renaming of the shortcuts or groups.


REFERENCES

For additional information about available resources and answers to commonly asked questions about Microsoft Outlook 2000 solutions, please see the following article in the Microsoft Knowledge Base:

Q146636 OL2000: Questions About Custom Forms and Outlook Solutions

Additional query words: OutSol OutSol2000 OL2K

Keywords : kbdta
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbhowto


Last Reviewed: May 26, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.