主题:求助:outlook2003中NewInspector事件问题
最近在用vb6做一个outlook2003的按钮事件,就是在NewInspector中添加按钮事件,但就是在outlook工具栏中显示不出来?不知道什么原因,为高手指点,我也刚学,不太懂...
部分代码:
Private Sub goInspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
' Resume next since the FindControl call will generate an
' error if the button can not be found. We don't want to
' end, but add the button to the controlbar.
On Error Resume Next
' see if our button already exist on the commandbar
Dim oBar As Office.CommandBar
Set oBar = Inspector.CommandBars("Standard")
Set goButton = oBar.FindControl(Type:=msoControlButton, Id:=oBar.Controls("Send mass mail").Id)
' if it does not, then add it to the controlbar
If goButton Is Nothing Then
Set goButton = oBar.Controls.Add(1)
With goButton
.Caption = "Send mass mail"
.Style = MsoButtonStyle.msoButtonIconAndCaption
.Tag = "Send mass mail"
.OnAction = "!<Massmail.Connect>"
End With
End If
' use the same icon as the Send button for our button
Dim oSendButton As Office.CommandBarButton
Set oSendButton = oBar.FindControl(Type:=msoControlButton, Id:=oBar.Controls("Send").Id)
' only try setting the properties if found the Send button
If Not oSendButton Is Nothing Then
goButton.Style = msoButtonIconAndCaption
goButton.FaceId = oSendButton.FaceId
End If
' only show our button if this is a mail message
If Inspector.CurrentItem.Class = olMail Then
goButton.Visible = True
Else
goButton.Visible = False
End If
End Sub
求救啊!!!!可以编译通过的!但就出不来!!急死了!
部分代码:
Private Sub goInspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
' Resume next since the FindControl call will generate an
' error if the button can not be found. We don't want to
' end, but add the button to the controlbar.
On Error Resume Next
' see if our button already exist on the commandbar
Dim oBar As Office.CommandBar
Set oBar = Inspector.CommandBars("Standard")
Set goButton = oBar.FindControl(Type:=msoControlButton, Id:=oBar.Controls("Send mass mail").Id)
' if it does not, then add it to the controlbar
If goButton Is Nothing Then
Set goButton = oBar.Controls.Add(1)
With goButton
.Caption = "Send mass mail"
.Style = MsoButtonStyle.msoButtonIconAndCaption
.Tag = "Send mass mail"
.OnAction = "!<Massmail.Connect>"
End With
End If
' use the same icon as the Send button for our button
Dim oSendButton As Office.CommandBarButton
Set oSendButton = oBar.FindControl(Type:=msoControlButton, Id:=oBar.Controls("Send").Id)
' only try setting the properties if found the Send button
If Not oSendButton Is Nothing Then
goButton.Style = msoButtonIconAndCaption
goButton.FaceId = oSendButton.FaceId
End If
' only show our button if this is a mail message
If Inspector.CurrentItem.Class = olMail Then
goButton.Visible = True
Else
goButton.Visible = False
End If
End Sub
求救啊!!!!可以编译通过的!但就出不来!!急死了!