C
Chet
Hi I have created an addin for outlook in VB6.0. Each time a new inspector
is opened I check to see if it is a mailitem and if so I add a command bar
and button to the inspector window. The button works fine until another
inspector window is opened and then it stops working and will only work for
the new inspector window. I know this happens becuase when the NewInspector
event fires I set the command bar button to the new inspector and therefore
will only work for the newest one opened. How do I get it to still work for
all the other inspectors that are already opened.
Private Sub ins_NewInspector(ByVal inspector As Outlook.inspector)
Dim cb As CommandBar
On Error Resume Next
If TypeName(inspector.CurrentItem) = "MailItem" Then
If Not inspector.IsWordMail Then
Set cb = inspector.CommandBars("FilePro Bar")
If cb Is Nothing Then
Set cb = inspector.CommandBars.Add("FilePro Bar", msoBarTop, ,
True)
Set cbAttachDoc = cb.Controls.Add(1, , , , True)
With cbAttachDoc
.Caption = "&Attach document"
.FaceId = 271
.Style = msoButtonIconAndCaption
.ToolTipText = "Attach document from FilePro"
End With
End If
cb.Visible = True
End If
End If
End Sub
is opened I check to see if it is a mailitem and if so I add a command bar
and button to the inspector window. The button works fine until another
inspector window is opened and then it stops working and will only work for
the new inspector window. I know this happens becuase when the NewInspector
event fires I set the command bar button to the new inspector and therefore
will only work for the newest one opened. How do I get it to still work for
all the other inspectors that are already opened.
Private Sub ins_NewInspector(ByVal inspector As Outlook.inspector)
Dim cb As CommandBar
On Error Resume Next
If TypeName(inspector.CurrentItem) = "MailItem" Then
If Not inspector.IsWordMail Then
Set cb = inspector.CommandBars("FilePro Bar")
If cb Is Nothing Then
Set cb = inspector.CommandBars.Add("FilePro Bar", msoBarTop, ,
True)
Set cbAttachDoc = cb.Controls.Add(1, , , , True)
With cbAttachDoc
.Caption = "&Attach document"
.FaceId = 271
.Style = msoButtonIconAndCaption
.ToolTipText = "Attach document from FilePro"
End With
End If
cb.Visible = True
End If
End If
End Sub