Without seeing your code it is impossible to guess what the problem is, however adding some error handling should indicate the problem. Select a message and run the following
Sub Test() 'Graham Mayor - https://www.gmayor.com - Last updated - 31 Oct 2020 Dim oItem As Object Dim PhoneNumberString As String On Error Resume Next Select Case Outlook.Application.ActiveWindow.Class Case olInspector Set oItem = ActiveInspector.currentItem Case olExplorer Set oItem = Application.ActiveExplorer.Selection.Item(1) End Select If TypeName(oItem) = "MailItem" Then If InStr(1, oItem.Subject, "Voicemail received from") > 0 Then PhoneNumberString = oItem.Subject PhoneNumberString = Mid(PhoneNumberString, InStr(1, PhoneNumberString, "(")) PhoneNumberString = Left(PhoneNumberString, InStr(2, PhoneNumberString, "(") - 1) Beep MsgBox PhoneNumberString Else MsgBox oItem.Subject & vbCr & "is not a voicemail message", vbCritical End If Else MsgBox "Not a mail item!", vbCritical End If lbl_Exit: Set oItem = Nothing Exit Sub End Sub




Reply With Quote