none
Using vb script to display to,cc and bcc field in a popup in MS Outlook? RRS feed

  • Question

  • Dear All,

    Could you please help me in writing vb script command which will extract the to, cc and bcc content and display it in a sort of popup window?

    actually i have a confirmation pop up which comes up before sending an email and I just want to add to, cc and bcc in the confirmation pop up window.

    thank you

    Thursday, March 17, 2011 10:50 AM

Answers

  • Hi Tom,

    Thanks a lot for your reply.

    Your suggestion did help me to find a solution.

    My final code:

    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim intRes As Integer
    Dim strMsg As String
    Dim i As String


    strMsg = "Do you really want to send this message now?" & Chr(13) & "Subject:" & Item.Subject & Chr(13) & "To: " & Item.To & Chr(9) & Chr(13) & "Cc: " & Item.CC & Chr(13) & Chr(10) & "Bcc: " & Item.BCC & Chr(13)

    intRes = MsgBox(strMsg, vbYesNo + vbDefaultButton1, "Confirm Send ")

    If intRes = vbNo Then
    Cancel = True
    End If

    End Sub

     

     

    One last question:

    Every time I'm sending an email, the message box is coming up.

    Is there a way to enable or disable the message box when emails are sent to high profile contact e.g you@ms.com

    I.e

    if item.to or item.cc or item.bcc equals to you@ms.com, enable message confirmation box else ignore it.

     

    Your help will be much appreciated.

    Thank you.

    • Marked as answer by 许阳(无锡)Moderator Monday, March 28, 2011 9:41 AM
    • Unmarked as answer by Ravmohun Thursday, March 31, 2011 5:53 AM
    • Marked as answer by Ravmohun Thursday, January 19, 2017 10:45 AM
    Monday, March 21, 2011 9:50 AM

All replies

  • Hi Ravmohun,

    Thanks for posting in the MSDN Forum.

    Do you want this? In this snippet I show the content of these fields.

    Sub test()
      Dim objInspector As Outlook.Inspector
      Dim objItem As Outlook.MailItem
      
      Set objInspector = Application.ActiveInspector
      Set objItem = objInspector.CurrentItem
      
      MsgBox "To->" & objItem.To & Chr(13) & "Sender->" & objItem.Sender & Chr(13) & "CC->" & objItem.CC & Chr(13) & "BCC->" & objItem.BCC
      
      Set objItem = Nothing
      Set objInspector = Nothing
    End Sub
    

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 21, 2011 5:30 AM
    Moderator
  • Hi Tom,

    Thanks a lot for your reply.

    Your suggestion did help me to find a solution.

    My final code:

    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim intRes As Integer
    Dim strMsg As String
    Dim i As String


    strMsg = "Do you really want to send this message now?" & Chr(13) & "Subject:" & Item.Subject & Chr(13) & "To: " & Item.To & Chr(9) & Chr(13) & "Cc: " & Item.CC & Chr(13) & Chr(10) & "Bcc: " & Item.BCC & Chr(13)

    intRes = MsgBox(strMsg, vbYesNo + vbDefaultButton1, "Confirm Send ")

    If intRes = vbNo Then
    Cancel = True
    End If

    End Sub

     

     

    One last question:

    Every time I'm sending an email, the message box is coming up.

    Is there a way to enable or disable the message box when emails are sent to high profile contact e.g you@ms.com

    I.e

    if item.to or item.cc or item.bcc equals to you@ms.com, enable message confirmation box else ignore it.

     

    Your help will be much appreciated.

    Thank you.

    • Marked as answer by 许阳(无锡)Moderator Monday, March 28, 2011 9:41 AM
    • Unmarked as answer by Ravmohun Thursday, March 31, 2011 5:53 AM
    • Marked as answer by Ravmohun Thursday, January 19, 2017 10:45 AM
    Monday, March 21, 2011 9:50 AM