Name

routingslip.Recipients [= setting]

Synopsis

Sets or returns an array containing the addresses of the recipients to include in the To field of the email. The order of the items in the array determines the order of delivery.

Warning

Setting this property displays an Outlook security warning. Don’t run code to set this property from within the Visual Basic Editor (as when debugging) since it may cause Excel to lock up.

You can use the Split function to convert a string containing multiple addresses into an array, as shown here:

    ' Don't run this from VBE! Use Tools>Macros>Macro>Run instead.
    Sub RouteActiveWorkbook( )
        Dim wb As Workbook, rs As RoutingSlip
        ' Trap error in case user cancels send.
        On Error Resume Next
        Set wb = ActiveWorkbook
        ' Get the routing slip.
        Set rs = wb.RoutingSlip
        ' Clear it.
        rs.Reset
        ' Set routing list. Use Split to convert address list to array.
        rs.Recipients = Strings.Split("someone@microsoft.com;" & _
            "someone@yourcompany.com;someoneelse@yourcompany.com", ";")
        rs.Subject = wb.Name
        rs.Message = "Please review and route on."
        ' Send the message.
        wb.Route
        On Error GoTo 0
    End Sub

Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.