OL2000: How to Prevent Changes to the Outlook Bar (222396)
The information in this article applies to:
This article was previously published under Q222396 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 Partner or the Microsoft fee-based
consulting line at (800) 936-5200. For more information about Microsoft Certified
Partners, please visit the following Microsoft Web site:
For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:
For additional information about how to manage Outlook Visual Basic for Applications projects, please see the following article in the Microsoft Knowledge Base: 229911 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:
- On the Tools menu, point to Macro, and then click Visual Basic Editor.
- 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.
- Add the following Visual Basic for Applications code to the
ThisOutlookSession module:
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
- 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: 146636 OL2000: Questions About Custom Forms and Outlook Solutions
Modification Type: | Major | Last Reviewed: | 10/8/2003 |
---|
Keywords: | kbhowto kbProgramming KB222396 |
---|
|