I want to send multiple msg files stored in a specific folder with one Excel button.
I am making a tool to send invoices to multiple customers.

Error message

We have done so far to create a msg file that sends a PDF file of an invoice to each recipient, but please tell me the code to send the msg file all at once.

Applicable source code Supplemental information (FW/tool version etc.)
  • Answer # 1

    I'm done now.
    The basic design is the same as the reference site.
    "Set msg = oApp.CreateItemFromTemplate (msgname)"
    In this part of the code
    Open multiple msg files stored in a folder
    I think that can be solved.

    Sub SendMsg ()
        'Set path * In the format that suits your source!
        Dim msgname As String
        msgname = "C: \ pass name \ file name.msg"
        '' Outlook variable initialization
        Dim oApp As Object
        Dim msg As Object
        Set oApp = CreateObject ("Outlook.Application")
        Set msg = oApp.CreateItem (olMailItem)
        'Set msg file and send
        Set msg = oApp.CreateItemFromTemplate (msgname)
        'Variable release
        Set olApp = Nothing
        Set msg = Nothing
    End Sub

    Personally, with this function as an argument "array containing the path",
    If the specification is to loop the part of '' msg file set and send 'by the number of array elements
    I thought it was easy to use.
    * It may be strange to open the msg variable for each email ...