error in item_open event

  • Thread starter Thread starter Raymond
  • Start date Start date
R

Raymond

Hi in the oultook visual basic help I found this by open mailitem

VB:

Function Item_Open()
If Item.Unread = False Then
myMsg = "Do you want to open this message again?"
If MsgBox myMsg,4) = 6 Then
Item_Open = True
Else
Item_Open = False
End If
End If
End Function



Because this is VBscript and I want to use VBA I edited the code to
this

VB:

Private Sub Application_Startup()
Item_Open
End Sub

Sub Item_Open()
Dim test
Dim outMailItem As MailItem
Set outMailItem = Application.ActiveExplorer.Selection
If outMailItem.UnRead = False Then
myMsg = "Do you want to open this message again?"
If MsgBox(myMsg, 4) = 6 Then
test = True
Else
test = False
End If
End If
End Sub



On the line
Set outMailItem = Application.ActiveExplorer.Selection

I get error 13: Types do not compare.

Can anyone tell me why?

Set outMailItem = Application.Activeinspector.currentitem gives

Error 91

Greetings raymond
 
What is it that you're actually trying to do? The VBScript Item_Open
function is an event handler and doesn't translate directly into VBA.
 
Back
Top