424 object required for object ReportItem

Joined
Mar 20, 2012
Messages
1
Reaction score
0
why error appears: 424 object required for below code

Sub test()
Dim msg as Object

If TypeOf msg Is MailItem Then
MsgForMailItem (msg) ' here works OK
ElseIf TypeOf msg Is ReportItem Then
MsgForReportItem (msg) ' here error appears: 424 Object required
End If
End Sub

Function MsgForReportItem (ri as Object)
MsgBox "Report"
' ... another actions
End Function

Function msgForMailItem (mi as Object)
MsgBox "Mail"
' ... another actions
End Function
 

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