none
Outlook Meeting invite VBA Code Help RRS feed

  • Question

  • Hello -

    I am trying to have a check for my outgoing meeting requests.  If I put in the Meeting subject, "WebEx", I then want to check the body to see if it contains the WebEx link.  So I took a phrase it always adds, "Join from a video", and have it look for it in the Meeting body.  If it finds it, it should do nothing.  If it does not find it, then it should pop up a warning and the opportunity to abort the send.

    It is not working below, and am not sure why.

    Any help would be appreciated.

    If Item.Class = olMeetingRequest Then
                If Item.Subject = "WebEx" Then
                  nAt = InStr(Item.Body, "Join from a video")
                  If nAt > 0 Then
                     Meet = 1
                End If
            End If
        End If

            If Item.Class = olMeetingRequest Then
                If Item.Subject = "WebEx" Then
                    If Meet <> 1 Then
                        prompt = "This invite does not contain WebEx Link.  Do you want to proceed?"
                             If MsgBox(prompt, vbYesNo + vbExclamation + vbMsgBoxSetForeground, "Check Address") = vbNo Then
                            Cancel = True
                            End If
                    End If
                End If
            End If

    Tuesday, September 19, 2017 8:12 PM

All replies

  • Hi Paul,

    Thanks for visiting our forum. Then here we mainly focus on general issues about Microsoft Outlook. Since your questions is more related to VBA code, I'll move it to the following dedicated MSDN forum for Outlook: 

    https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=outlookdev

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.  

    Best regards,
    Yuki Sun


    Please remember to mark the replies as answers if they helped.

    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Wednesday, September 20, 2017 2:39 AM
  • Hello Paul,

    Try to use another item check instead:

    If TypeName(Item) = "MeetingItem" Then
                If Item.Subject = "WebEx" Then
                  nAt = InStr(Item.Body, "Join from a video")
                  If nAt > 0 Then
                     Meet = 1
                End If
            End If
        End If
    
            If TypeName(Item) = "MeetingItem" The
                If Item.Subject = "WebEx" Then
                    If Meet <> 1 Then
                        prompt = "This invite does not contain WebEx Link.  Do you want to proceed?"
                             If MsgBox(prompt, vbYesNo + vbExclamation + vbMsgBoxSetForeground, "Check Address") = vbNo Then
                            Cancel = True
                            End If
                    End If
                End If
            End If


    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers


    Wednesday, September 20, 2017 2:06 PM
  • Hi Paul-AZ,

    I failed to reproduce your issue. I could see the message box pop up and the meeting cancel sending after selecting "NO" in the message box.

    What do you mean it's not working? What's your test steps?

    If you set a breakpoint to test the code line by line, which line would get wrong result as you want?

    Best Regards,

    Terry

    Thursday, September 21, 2017 6:17 AM