Inspector problems

B

BigOil

I am trying to control the visibility of certain command bars when a
new window is opened in Outlook (such as opening an e-mail or creating
a new e-mail). The following from outlook vba help seems to be exactly
what I'm looking for. However, I don't know how to call the
Initialize_handler routine which the help says must be called before
the event procedure can be called by MS Outlook. Does anyone know how
I can do this?

(from MS Outlook help)

This Microsoft Visual Basic/Visual Basic for Applications (VBA)
example displays the Standard and Formatting toolbars of an inspector
when it is opened. The sample code must be placed in a class module,
and the Initialize_handler routine must be called before the event
procedure can be called by Microsoft Outlook.

Dim myOlApp As New Outlook.Application
Public WithEvents myOlInspectors As Outlook.Inspectors

Public Sub Initialize_handler()
Set myOlInspectors = myOlApp.Inspectors
End Sub

Private Sub myOlInspectors_NewInspector(ByVal Inspector As
outlook.Inspector)
Inspector.CommandBars.Item("Standard").Visible = True
Inspector.CommandBars.Item("Formatting").Visible = True
End Sub


Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top