【问题标题】:Pull Excel Data Table entries into recipients for Outlook email template将 Excel 数据表条目拉入 Outlook 电子邮件模板的收件人
【发布时间】:2020-06-24 16:05:59
【问题描述】:

目标是将 Excel 数据表/数据透视表连接到 Outlook 电子邮件模板。

有没有办法将原始条目创建者从数据透视表或表格字段中拉到收件人部分以发送电子邮件?我正在尝试自动从此数据表中向多个用户发送电子邮件。有关向谁发送电子邮件的信息在表中。

这是我目前所拥有的:

Sub SendMail()
    Dim olApp As Outlook.Application 
    Dim olMail As Outlook.MailItem 
    Dim  blRunning As Boolean

    blRunning = True 
    on Error Resume Next 
    Set olApp = GetObject (,"Outlook.Application") 
    If olApp Is Nothing Then 
        Set olApp = New Outlook.Application 
        blRunning = False 
    End If  
    On Error GoTo 0 

    Set olMail = olApp.CreateItem(olMailItem) 
    With olMail 
        .Subject = "Automatic Entry Support" 
        .Recipients.Add "J.Doe@gmail.com"  
        .Attachments.Add "C:\Users\J.Doe\Documents\Project\Template draft.xlsx"  
        .Body = "Support message" 
        .Display ("Spell check, data attached?, SEND")
    End With
    If Not blRunning Then olApp.Quit

    Set olApp = Nothing
    Set olMail = Nothing
End Sub

【问题讨论】:

    标签: excel vba outlook


    【解决方案1】:

    找到表格的最后一行并 for 循环遍历收件人。看看这个:

    https://www.rondebruin.nl/win/s1/outlook/mail.htm

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-20
      • 1970-01-01
      • 2020-12-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多