从单元格中查找电子邮件地址

时间:2015-09-17 16:47:55

标签: excel vba email

我想将自动发送的电子邮件发送到电子邮件地址,该电子邮件地址将从我的Outlook电子表格中的已定义单元格中读取(例如,固定... D,4)。

我已附上下面的代码,有人可以帮我这个吗?

Sub Button1_Click()
    Dim OApp As Object, OMail As Object, signature As String
    Set OApp = CreateObject("Outlook.Application")
    Set OMail = OApp.CreateItem(0)
    With OMail
        .Display
    End With

    With OMail
        .To = ""
        .Subject = "Feedback Form"
        .Display
    End With

    Set OMail = Nothing
    Set OApp = Nothing
End Sub

1 个答案:

答案 0 :(得分:0)

您可以像这样从 D4 单元格中读取值:

With OMail
    .To = Sheets("Your Sheet Name").Range("D4").Value
    .Subject = "Feedback Form"
    .Display
End With