none
Select multiple Outlook cc: email addresses using MS Word VBA RRS feed

  • Question

  • Hi.  I have a routine in MS Excel that calls a word routine (MS Excel lacks this functionality and uses Word vba) that opens up an Outlook Dialogue box where the User can select an Outlook User to cc:.  Problem is that the routine only allows the User to select one cc:  address.  The requirement is to cc: multiple addresses.  Below is the existing code.  Your help is greatly appreciated.

       Dim objWordApp As Object, _
            strEmail As String, _
            intCount As Integer
       
        ' As GetAddress is not available in MS Excel, a call to MS Word object
        ' has been made to borrow MS Word's functionality
        Application.DisplayAlerts = False
        On Error Resume Next
        Set objWordApp = CreateObject("Word.Application")
        strEmail = objWordApp.GetAddress
        objWordApp.Quit
        Set objWordApp = Nothing
        On Error GoTo 0
        Application.DisplayAlerts = True

        ' Nothing was selected
        If strEmail = "" Then Exit Function

        intCount = IIf(InStr(strEmail, vbCr) > 0, InStr(strEmail, vbCr) - 1, Len(strEmail))
        getEmail = Mid(strEmail, 1, intCount)

    Johnny.

    Tuesday, July 13, 2010 8:58 PM

Answers

  • Hello Johnny,

    As far as I see, GetAddress method only returns one address. For this method, please see this MSDN page: http://msdn.microsoft.com/en-us/library/bb221379(office.12).aspx. From this code, it seems that there is no code for this address on CC field. Would you please tell how you do this? If you want to use multiple addresses, you also could use GetAddress one more time.

    If you have any concern for this post, or I have mistaken this scenario, please feel free to follow up.

    Best regards,
    Bessie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by Bessie Zhao Tuesday, July 20, 2010 10:09 AM
    Thursday, July 15, 2010 8:08 AM

All replies

  • Hello Johnny,

    As far as I see, GetAddress method only returns one address. For this method, please see this MSDN page: http://msdn.microsoft.com/en-us/library/bb221379(office.12).aspx. From this code, it seems that there is no code for this address on CC field. Would you please tell how you do this? If you want to use multiple addresses, you also could use GetAddress one more time.

    If you have any concern for this post, or I have mistaken this scenario, please feel free to follow up.

    Best regards,
    Bessie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by Bessie Zhao Tuesday, July 20, 2010 10:09 AM
    Thursday, July 15, 2010 8:08 AM
  • This is a few years old, but I was just facing the same problem and was rapt to see there was a very easy solution.

    If you use the GetAddress as explained here
    http://msdn.microsoft.com/en-us/library/office/aa172199%28v=office.11%29.aspx, the  SelectDialog   argument allows the selection of several addresses (1 for the To field and 2 for the To and CC field)

    For example

    Set To = Application.GetAddress(, "<PR_DISPLAY_NAME>", False, 1, 2, , True, True)

    Will bring up an Outlook dialog box that with the To and CC fields, in which you can enter (select) several addresses.

    Easy!

    Friday, February 14, 2014 5:29 AM