I have a problem where the MessageBox function causes an Outlook Item object to be released (COM object that has been separated from its underlying RCW). The following code works fine if I comment out the MessageBox function, but produces an error when it is included. Can anyone explain what I am doing wrong?
Public Sub TestMsgBox(p_item As Object) Dim z_type As String = Nothing Dim z_result As Integer = 0 If Not IsNothing(p_item) Then Try z_result = MessageBox.Show("An item has been passed") If TypeOf p_item Is Outlook.AppointmentItem Then z_type = "Appointment Item" End If Catch ex As Exception System.Diagnostics.Debug.Print("ERROR") End Try End If End Sub
MikePL