通过 excel 在线发送电子邮件

Send email via excel online

我有两个 sheet。一个包含完整信息,另一个 sheet 包含有关一名学生的某些信息,必须通过电子邮件发送。请看下面的截图:

在这里,第二个作品sheet 有学生 ID 字段,我希望能够在其中写入行号并使用之前 sheet 中的正确信息自动填充下面的空白。然后我希望能够将该作品 sheet 作为电子邮件发送。我只知道 excel 的基础知识,我正在在线使用 excel。有什么办法可以在线使用 excel 来完成吗?我搜索了很多但找不到任何解决方案。请帮帮我。谢谢。

您可以使用宏来发送电子邮件,然后使用快捷键、手动触发或添加调用它的按钮。要创建一个,请按 Alt - F11 打开编辑器。点击插入->模块,添加如下代码:

Sub SendEmail()
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String


Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

strbody = "Dear parent," & vbNewLine & vbNewLine & _
          "This is your child's report:" & vbNewLine
          Cells(1, 4).Value & " :" & Cells(2, 4).Value & vbNewLine
          Cells(1, 6).Value & " :" & Cells(2, 6).Value & vbNewLine
          Cells(1, 7).Value & " :" & Cells(2, 7).Value & vbNewLine
          Cells(1, 8).Value & " :" & Cells(2, 8).Value & vbNewLine
          Cells(1, 9).Value & " :" & Cells(2, 9).Value

On Error Resume Next
With OutMail
    .To = Cells(1,12).Value
    .CC = ""
    .BCC = ""
    .Subject = "Student Report"
    .Body = strbody
    .Send
End With
On Error GoTo 0

Set OutMail = Nothing
Set OutApp = Nothing
End Sub

您在 strbody 中输入的任何内容都将成为电子邮件的正文。您可以使用 Cells(columnnumber, rownumber).Value 函数来使用单元格的值。您可以手动或使用快捷键查看 this support page to see how to use a button, or at this page 到 运行。先发给自己再确认一下,根据自己的喜好编辑。