Прикрепление сделанных на заказ файлов для отправки электронных писем из списка в электронной таблице - PullRequest
0 голосов
/ 14 июня 2019

Я новичок в кодировании и пытаюсь прикрепить отдельные файлы со своего рабочего стола к отдельным электронным письмам, созданным моим текущим макросом. имена файлов сохраняются на листе в активном ББ, в котором находятся имена и электронные письма моих получателей. Я хочу сопоставить имя файла с соответствующим получателем и прикрепить файл к моей электронной почте для этого получателя.

Буду признателен за любую помощь или совет.

Я попытался добавить некоторые решения, которые я нашел в Интернете, но все еще не могу понять это.

Sub SendEmailfromOutlook()
    Dim OutApp As Object
    Dim OutMail As Object
    Dim cell As Range
    Dim Path As String
    Set OutApp = CreateObject("Outlook.Application")

    For Each cell In Range("B2:B123")
        Set OutMail = OutApp.CreateItem(0)
              With OutMail
                .To = cell.Value
                .Subject = "Datalocker User Check"
                .Body = "Hello " & Cells(cell.Row, "A").Value & "," _
                      & vbNewLine & "** Requires Response **" & vbCr & vbCr & _
                      "If you have received this email it is because we are doing a user check on datalocker secure file transfer." & vbCr & _
                      "Attached you will see a spreadsheet that shows all active users currently at your organisation." & vbCr & vbCr & _
                      "Normally we would request a form in order to make amendments but in this instance and for every new school term we will make all amendments that you need if you respond to this email" & vbCr & _
                      "I have attached a file for reference to roles and the functions they have." & vbCr & _
                      "Any new user that needs adding please fill their details in at the bottom of the table and we will add them as soon as we can." & vbCr & vbCr & _
                      "Can you also answer the following questions, these are being asked so we can update our records of these two roles in your school since there has been changes to staff in these roles that we haven't updated." & vbCr & vbCr & _
                      "Who is the current Headteacher and what is their email?" & vbCr & vbCr & _
                      "Who is the current Business/Office Manager and what is their email" & vbCr & vbCr & _
                      "Kind Regards" & vbCr & vbCr & _
                      "" & vbCr & _
                      "" & vbCr & _
                      "" & vbCr & _
                      "" & vbCr & _
                      ""
                .Save
            End With
    Next cell
End Sub
...