Consulting

Results 1 to 2 of 2

Thread: 424 object required for reportitem object

  1. #1
    VBAX Newbie
    Joined
    Mar 2012
    Posts
    1
    Location

    424 object required for reportitem object

    why error appears: 424 object required for below code

    Sub test()
    Dim msg as Object

    If TypeOf msg Is MailItem Then
    MsgForMailItem (msg) ' here is 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 action
    End Function

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

  2. #2
    VBAX Expert JP2112's Avatar
    Joined
    Oct 2008
    Location
    Astoria, NY
    Posts
    590
    Location
    Where is the code that shows how you are using the "msg" variable before entering the If statement?
    Regards,
    JP

    Read the FAQ
    Getting free help on the web
    My website
    Please use [vba][/vba] tags when posting code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •