Note: The other languages of the website are Google-translated. Back to English
登陆  \/ 
x
or
x
点此注册  \/ 
x

or

如何仅通过Excel从Outlook发送工作表?

如果要通过Outlook通过Excel从工作簿中通过电子邮件发送单个工作表,则可以将工作表作为附件,正文内容或PDF文件发送。 但是,有没有更快的方法可以让您在Excel中处理此问题?

使用“发送到邮件收件人”命令从Excel发送单个工作表作为正文

使用VBA代码从Excel发送单个工作表作为附件

使用VBA代码从Excel发送单个工作表为PDF文件


箭头蓝色右气泡 使用“发送到邮件收件人”命令从Excel发送单个工作表作为正文

Excel支持我们使用“发送到邮件收件人”命令通过电子邮件将活动工作表作为正文内容发送。 您可以执行以下操作:

如果您使用Excel 2007、2010或2013,则需要添加 发送到邮件收件人 命令 快速访问工具栏 第一。

1。 点击图标 自定义快速访问工具栏,并选择 更多命令,请参见屏幕截图:

doc-email-sheet1

2. 在中 Excel选项 对话框,选择 功能区中没有的命令从中选择命令 下拉列表,然后选择 发送到邮件收件人 选项,然后单击 添加>> 按钮添加此命令,最后单击 OK 保存此设置。 看截图:

doc-email-sheet2

3. - 发送到邮件收件人 命令已插入 快速访问工具栏,请参见屏幕截图:

doc-email-sheet3

4。 然后点击这个 发送到邮件收件人 图标按钮,并弹出一个提示框, 邮箱 提示框,选中 发送当前工作表作为邮件正文和点击 OK。 看截图:

doc-email-sheet4

5。 在工作表数据上方将显示一个电子邮件编辑框,您可以在相应的文本框中输入收件人,主题和简介。 看截图:

doc-email-sheet5

6. 然后点击 发送此Sheet将此活动工作表作为邮件正文发送给您的特定人员。


箭头蓝色右气泡 使用VBA代码从Excel发送单个工作表作为附件

如果您想通过电子邮件将活动工作表作为附件发送,以下VBA代码可以为您提供帮助。

1。 激活您要发送的工作表。

2。 按住 ALT + F11 键,然后打开 Microsoft Visual Basic for Applications窗口.

3。 点击 插页 > 模块,然后将以下代码粘贴到 模块窗口.

VBA代码:从Excel发送当前工作表作为附件

Sub SendWorkSheet()
'Update 20131209
Dim xFile As String
Dim xFormat As Long
Dim Wb As Workbook
Dim Wb2 As Workbook
Dim FilePath As String
Dim FileName As String
Dim OutlookApp As Object
Dim OutlookMail As Object
On Error Resume Next
Application.ScreenUpdating = False
Set Wb = Application.ActiveWorkbook
ActiveSheet.Copy
Set Wb2 = Application.ActiveWorkbook
Select Case Wb.FileFormat
Case xlOpenXMLWorkbook:
    xFile = ".xlsx"
    xFormat = xlOpenXMLWorkbook
Case xlOpenXMLWorkbookMacroEnabled:
    If Wb2.HasVBProject Then
        xFile = ".xlsm"
        xFormat = xlOpenXMLWorkbookMacroEnabled
    Else
        xFile = ".xlsx"
        xFormat = xlOpenXMLWorkbook
    End If
Case Excel8:
    xFile = ".xls"
    xFormat = Excel8
Case xlExcel12:
    xFile = ".xlsb"
    xFormat = xlExcel12
End Select
FilePath = Environ$("temp") & "\"
FileName = Wb.Name & Format(Now, "dd-mmm-yy h-mm-ss")
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
Wb2.SaveAs FilePath & FileName & xFile, FileFormat:=xFormat
With OutlookMail
    .To = "skyyang@extendoffice.com"
    .CC = ""
    .BCC = ""
    .Subject = "kte features"
    .Body = "Please check and read this document."
    .Attachments.Add Wb2.FullName
    .Send
End With
Wb2.Close
Kill FilePath & FileName & xFile
Set OutlookMail = Nothing
Set OutlookApp = Nothing
Application.ScreenUpdating = True
End Sub

备注:在上面的代码中,您可以根据自己的需要更改以下信息。

  • .To =“ skyyang @extendoffice.com”
  • .CC =“”
  • .BCC =“”
  • .Subject =“ KTE功能”
  • .Body =“请检查并阅读本文档。”

4。 然后点击 F5 键运行此代码,然后会弹出一个提示框,单击 进度条完成时,然后当前工作表已作为附件发送给您的收件人。

doc-email-sheet6


箭头蓝色右气泡 使用VBA代码从Excel发送单个工作表为PDF文件

有时,您需要将工作表报告发送给其他人,但不希望其他人修改它。 在这种情况下,您可以从Excel将工作表作为PDF文件发送。

1. 激活您要发送的工作表。

2。 按住 ALT + F11 键,然后打开 Microsoft Visual Basic for Applications窗口.

3。 点击 插页 > 模块,然后将以下代码粘贴到 模块窗口.

VBA代码:从Excel以PDF文件形式发送当前工作表

Sub SendWorkSheetToPDF()
'Update 20131209
Dim Wb As Workbook
Dim FileName As String
Dim OutlookApp As Object
Dim OutlookMail As Object
On Error Resume Next
Set Wb = Application.ActiveWorkbook
FileName = Wb.FullName
xIndex = VBA.InStrRev(FileName, ".")
If xIndex > 1 Then FileName = VBA.Left(FileName, xIndex - 1)
FileName = FileName & "_" + ActiveSheet.Name & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=FileName
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
With OutlookMail
    .To = "skyyang@extendoffice.com"
    .CC = ""
    .BCC = ""
    .Subject = "kte features"
    .Body = "Please check and read this document."
    .Attachments.Add FileName
    .Send
End With
Kill FileName
Set OutlookMail = Nothing
Set OutlookApp = Nothing
End Sub

注意:在上面的代码中,您可以根据需要更改以下信息。

  • .To =“ skyyang @extendoffice.com”
  • .CC =“”
  • .BCC =“”
  • .Subject =“ KTE功能”
  • .Body =“请检查并阅读本文档。”

4。 然后按 F5 键,然后会弹出一个提示框,单击 进度条确定后,活动的工作表已作为PDF文件发送给特定的人。

doc-email-sheet6

备注:

1.这些方法仅在将Outlook用作邮件程序时可用。

2.发送当前工作表后,您可以转到Outlook以确保已成功发送电子邮件。


创建邮件列表然后发送电子邮件

- Kutools for Excel's 创建邮件列表 以及 发送 电子邮件 实用程序可以在工作表中快速创建邮件列表,然后将相同的主题,相同的内容和相同的附件发送到多个电子邮件地址。
doc邮件清单1
doc向下箭头
doc邮件清单2

相关文章:

如何通过Outlook从Excel发送当前工作簿?

如何通过Excel从Outlook发送/通过电子邮件发送单元格范围?


最佳办公效率工具

Kutools for Excel解决了您的大多数问题,并使您的生产率提高了80%

  • 重用: 快速插入 复杂的公式,图表 以及您以前使用过的任何东西; 加密单元 带密码 创建邮件列表 并发送电子邮件...
  • 超级公式栏 (轻松编辑多行文本和公式); 阅读版式 (轻松读取和编辑大量单元格); 粘贴到过滤范围...
  • 合并单元格/行/列 不会丢失数据; 拆分单元格内容; 合并重复的行/列...防止细胞重复; 比较范围...
  • 选择重复或唯一 行; 选择空白行 (所有单元格都是空的); 超级查找和模糊查找 在许多工作簿中; 随机选择...
  • 确切的副本 多个单元格,无需更改公式参考; 自动创建参考 到多张纸; 插入项目符号,复选框等...
  • 提取文字,添加文本,按位置删除, 删除空间; 创建和打印分页小计; 在单元格内容和注释之间转换...
  • 超级滤镜 (将过滤方案保存并应用于其他工作表); 高级排序 按月/周/日,频率及更多; 特殊过滤器 用粗体,斜体...
  • 结合工作簿和工作表; 根据关键列合并表; 将数据分割成多个工作表; 批量转换xls,xlsx和PDF...
  • 超过300种强大功能。 支持Office / Excel 2007-2019和365。支持所有语言。 在您的企业或组织中轻松部署。 完整功能30天免费试用。 60天退款保证。
kte选项卡201905

Office选项卡为Office带来了选项卡式界面,使您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
officetab底部
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Bhattacharjee · 1 years ago
    This is to inform you that i have an VBA code for send email from outlook with the help of excel vba,now i want to put "MDD Code" & " MDD Name" as well as Cells(i, 1) & Cells(i, 2) in a table like that.

    MDD Code MDD Name
    M123 Joydip

    I am sending you the VBA Code,Request you for help.
    VBA Code
    ----------------------------------------------------------------------------------------------------------------------------------------------
    Sub sendmail()

    Dim olapp As Outlook.Application

    Dim olmail As Outlook.MailItem

    For i = 2 To 35

    Application.ScreenUpdating = False

    Set olapp = New Outlook.Application

    Set olmail = olapp.CreateItem(olMailItem)

    With olmail

    olmail.To = Cells(i, 4).Value

    olmail.CC = Cells(i, 6).Value

    olmail.Subject = Cells(i, 7).Value

    olmail.HTMLBody = "Dear Partner ," & _

    "
    Please find the attchment." & _

    "

    MDD Code : " & Cells(i, 1) & _

    "
    MDD Name : " & Cells(i, 2) & _

    "






    Joydip Bhattacharjee" & _

    "
    Company" & _

    "
    MIS" & _

    "
    Country" & _

    "
    Contact No : 7602066491"







    olmail.Attachments.Add Cells(i, 8).Value

    'On Error Resume Next

    'olmail.Attachments.Add Cells(i, 9).Value

    'On Error Resume Next

    'olmail.Attachments.Add Cells(i, 10).Value

    'On Error Resume Next

    'olmail.Attachments.Add Cells(i, 11).Value

    'On Error Resume Next

    'olmail.Attachments.Add Cells(i, 12).Value

    'On Error Resume Next

    'olmail.Attachments.Add Cells(i, 13).Value

    'On Error Resume Next

    'olmail.Attachments.Add Cells(i, 14).Value

    'On Error Resume Next

    olmail.Send

    End With

    Set olmail = Nothing

    Next

    End Sub
  • To post as a guest, your comment is unpublished.
    mehmet · 2 years ago
    merhaba ben bunu belirli periyotta otomatik mail atmasını nasıl ayarlayabilirim
  • To post as a guest, your comment is unpublished.
    Oscar Eseisa · 3 years ago
    Excelent code. Thanks!
  • To post as a guest, your comment is unpublished.
    Dave · 3 years ago
    Anyway I can easily send an excel worksheet through my outlook without all this ?? I can send the worksheet context, but no the workbook as an attachment. On my work computer I can send from word and excel, but am having trouble at home.
  • To post as a guest, your comment is unpublished.
    Richard · 3 years ago
    Hi! Is it possible to use this code, but instead of sending straight away it opens up the mail?
    • To post as a guest, your comment is unpublished.
      Sunny · 3 years ago
      You can try this code:
      Sub SendWorkSheet()
      'Update 20180109
      Dim xFile As String
      Dim xFormat As Long
      Dim Wb As Workbook
      Dim Wb2 As Workbook
      Dim FilePath As String
      Dim FileName As String
      Dim OutlookApp As Object
      Dim OutlookMail As Object
      On Error Resume Next
      Application.ScreenUpdating = False
      Set Wb = Application.ActiveWorkbook
      ActiveSheet.Copy
      Set Wb2 = Application.ActiveWorkbook
      Select Case Wb.FileFormat
      Case xlOpenXMLWorkbook:
      xFile = ".xlsx"
      xFormat = xlOpenXMLWorkbook
      Case xlOpenXMLWorkbookMacroEnabled:
      If Wb2.HasVBProject Then
      xFile = ".xlsm"
      xFormat = xlOpenXMLWorkbookMacroEnabled
      Else
      xFile = ".xlsx"
      xFormat = xlOpenXMLWorkbook
      End If
      Case Excel8:
      xFile = ".xls"
      xFormat = Excel8
      Case xlExcel12:
      xFile = ".xlsb"
      xFormat = xlExcel12
      End Select
      FilePath = Environ$("temp") & "\"
      FileName = Wb.Name & Format(Now, "dd-mmm-yy h-mm-ss")
      Set OutlookApp = CreateObject("Outlook.Application")
      Set OutlookMail = OutlookApp.CreateItem(0)
      Wb2.SaveAs FilePath & FileName & xFile, FileFormat:=xFormat
      With OutlookMail
      .To = "skyyang@extendoffice.com"
      .CC = ""
      .BCC = ""
      .Subject = "kte features"
      .Body = "Please check and read this document."
      .Attachments.Add Wb2.FullName
      .Display
      ' .Send
      End With
      Wb2.Close
      Kill FilePath & FileName & xFile
      Set OutlookMail = Nothing
      Set OutlookApp = Nothing
      Application.ScreenUpdating = True
      End Sub

      Please let me know if it works for you, thank you.
  • To post as a guest, your comment is unpublished.
    Sherry · 4 years ago
    This code works good, however, does anyone know a way to automate a field as an alert for the email to go automatically based on a date column?
  • To post as a guest, your comment is unpublished.
    Adanma · 4 years ago
    Kindly help me out urgently. This the first time I am using the send current worksheet as PDF but the below code did not work at all and the dialogue to allow did not show up when I presses ctrl+G.

    I also want to know what to change to reference a cell that contained the email address instead of "to a specific email address.

    Sub SendWorkSheetToPDF()
    'Update 20131209
    Dim Wb As Workbook
    Dim FileName As String
    Dim OutlookApp As Object
    Dim OutlookMail As Object
    On Error Resume Next
    Set Wb = Application.ActiveWorkbook
    FileName = Wb.FullName
    xIndex = VBA.InStrRev(FileName, ".")
    If xIndex > 1 Then FileName = VBA.Left(FileName, xIndex - 1)
    FileName = FileName & "_" + ActiveSheet.Name & ".pdf"
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=FileName
    Set OutlookApp = CreateObject("Outlook.Application")
    Set OutlookMail = OutlookApp.CreateItem(0)
    With OutlookMail
    .To = "skyyang@extendoffice.com"
    .CC = ""
    .BCC = ""
    .Subject = "kte features"
    .Body = "Please check and read this document."
    .Attachments.Add FileName
    .Send
    End With
    Kill FileName
    Set OutlookMail = Nothing
    Set OutlookApp = Nothing
    End Sub
  • To post as a guest, your comment is unpublished.
    Ramakumar · 5 years ago
    Sir

    I am able to send selected worksheet as attachment by including subject & Text.
    But the file name is showing as book1-02-apr-2016....

    Instead i want to give the file name in the code itself ( same name to continue every time i send)

    Kindly helpme
  • To post as a guest, your comment is unpublished.
    Archana · 5 years ago
    Can we allow the user to add the email ID with above mentioned code... Its works really good if we mention the To email id...
  • To post as a guest, your comment is unpublished.
    CHARLES · 5 years ago
    hi,
    im french , sorry for my english.
    How is it possible to put the value's cell of my sheet in .too/ .CC ...

    i think is it like :

    Sub SendWorkSheet()
    'Update 20131209
    Dim xFile As String
    Dim xFormat As Long
    Dim Wb As Workbook
    Dim Wb2 As Workbook
    Dim FilePath As String
    Dim FileName As String
    Dim OutlookApp As Object
    Dim OutlookMail As Object
    On Error Resume Next
    Application.ScreenUpdating = False
    Set Wb = Application.ActiveWorkbook
    ActiveSheet.Copy
    Set Wb2 = Application.ActiveWorkbook
    Select Case Wb.FileFormat
    Case xlOpenXMLWorkbook:
    xFile = ".xlsx"
    xFormat = xlOpenXMLWorkbook
    Case xlOpenXMLWorkbookMacroEnabled:
    If Wb2.HasVBProject Then
    xFile = ".xlsm"
    xFormat = xlOpenXMLWorkbookMacroEnabled
    Else
    xFile = ".xlsx"
    xFormat = xlOpenXMLWorkbook
    End If
    Case Excel8:
    xFile = ".xls"
    xFormat = Excel8
    Case xlExcel12:
    xFile = ".xlsb"
    xFormat = xlExcel12
    End Select
    FilePath = Environ$("temp") & "\"
    FileName = Wb.Name & Format(Now, "dd-mmm-yy h-mm-ss")
    Set OutlookApp = CreateObject("Outlook.Application")
    Set OutlookMail = OutlookApp.CreateItem(0)
    Wb2.SaveAs FilePath & FileName & xFile, FileFormat:=xFormat
    With OutlookMail
    .To = "skyyang@extendoffice.com" & RANGE("AVIVA!b12")
    .CC = "" & RANGE("AVIVA!c12")
    .BCC = ""
    .Subject = "NOUVEAU DOSSIER"
    .body = "Please check and read this document."
    .Attachments.Add Wb2.FullName
    .DISPLAY
    .Send
    End With
    Wb2.Close
    Kill FilePath & FileName & xFile
    Set OutlookMail = Nothing
    Set OutlookApp = Nothing
    Application.ScreenUpdating = True
    End Sub

    thank's for you help
  • To post as a guest, your comment is unpublished.
    Karan · 6 years ago
    Hi The macro works for me perfectly fine. I have never used macros before so, can anyone please put me in the right direction - I am trying to send this to more than one person but not sure how put extra email addresses in the "to" section of the macro.

    Thanks in advance
  • To post as a guest, your comment is unpublished.
    Jash · 6 years ago
    Hey I am using a automation process in my company I need to upgrade all my pc with the excel and outlook 2010 i have a code in windows xp with which i am mailing a sheet using outlook express the code is working fine in xp but now i need to upgrade it with windows 7 . I tried alot but i cant send the sheet so plz help
  • To post as a guest, your comment is unpublished.
    Jerry · 6 years ago
    Send single worksheet as an attachment from Excel with VBA code: Excellent VBA Code. Works GREAT !!! Thank you!!! :-)
    Instead of entering the To: & CC: e-mails manually, I want to pull the e-mail addresses from a separate worksheet called "E-Mail List". The (a1) has the "To" e-mail address and (b1) has the "CC" e-mail address. I know this is relatively simple to solve but I cannot figure out what I am doing wrong.

    Thank you everyone in advance.

    Wb2.SaveAs FilePath & FileName & xFile, FileFormat:=xFormat
    With OutlookMail
    .To = "skyyang@extendoffice.com"
    .CC = ""
    .BCC = ""
    .Subject = "kte features"
    .Body = "Please check and read this document."
    .Attachments.Add Wb2.FullName
    .Send
    End With
    Wb2.Close
    Kill FilePath & FileName & xFile
    Set OutlookMail = Nothing
    Set OutlookApp = Nothing
    Application.ScreenUpdating = True
    End Sub
  • To post as a guest, your comment is unpublished.
    Shel · 6 years ago
    I'm trying to use this code to send a single spreadsheet using a personally created template *.ost file that resides on the c:\ drive. Can't seem to figure out how to adapt the code above for that. Any pointers?
  • To post as a guest, your comment is unpublished.
    Janet · 6 years ago
    Hi, I am using Office 2010 and Windows 7.
    Thanks!
    • To post as a guest, your comment is unpublished.
      admin_jay · 6 years ago
      [quote name="Janet"]Hi, I am using Office 2010 and Windows 7.
      Thanks![/quote]
      Hello, this VBA is OK with Office 2010 in Window 7. Please make sure you have open your Outlook before running this VBA.
  • To post as a guest, your comment is unpublished.
    Janet · 6 years ago
    I am using the code above to send a single sheet as an excel attachment, the problem I am having, is that it is sending the whole workbook, not just a single worksheet.
    I only changed the "To", "Subject" and "Body" for the email.
    I am not sure what went wrong.
    Help Please! :sad:
    • To post as a guest, your comment is unpublished.
      admin_jay · 6 years ago
      [quote name="Janet"]I am using the code above to send a single sheet as an excel attachment, the problem I am having, is that it is sending the whole workbook, not just a single worksheet.
      I only changed the "To", "Subject" and "Body" for the email.
      I am not sure what went wrong.
      Help Please! :sad:[/quote]
      Hello, please tell me the version information of your Office and computer system.
  • To post as a guest, your comment is unpublished.
    Janet · 6 years ago
    I am using the second example above to send a single sheet out of the workbook, but it is sending the whole workbook. I copied the above example and the only part I changed was the email address.
    I am not sure what is wrong.
  • To post as a guest, your comment is unpublished.
    SomeOneVBA · 6 years ago
    Hi,

    I'm using this code but I have any issue when sending.
    It's not a big problem but I don't like it :-)

    I first auto save the file to a certain location via VBA before sending the file by mail. The file already has name ending on .xlsx

    When emailing the file, the attachement reads .xlsx.xlsx so it adds .xslx to the file.

    Does anybody know if I can it to ignore saving before sending it as attachment ? I already have it saved before sending...

    Thanks,
  • To post as a guest, your comment is unpublished.
    Jim Bristow · 6 years ago
    I am attempting to Send Multiple Name Ranges within given workbooks as PDF's via Outlook. Automating open and closing numerous workbooks. I am not certain how to modify stated code below which works great sending a worksheet with All new versions on Laptop. I sent multiple reports each night off my desk top Windows 7 Excel and Outlook 10 Adobe Acrobat Pro 10 and attempting to reconfigure to do same on laptop with upgraded versions of windows 8.1 Office 15 and adobe acrobat Xl.

    Your Recommended Codes for Sending Worksheets

    Sub SendWorkSheetToPDF()
    'Update 20131209
    Dim Wb As Workbook
    Dim FileName As String
    Dim OutlookApp As Object
    Dim OutlookMail As Object
    On Error Resume Next
    Set Wb = Application.ActiveWorkbook
    FileName = Wb.FullName
    xIndex = VBA.InStrRev(FileName, ".")
    If xIndex > 1 Then FileName = VBA.Left(FileName, xIndex - 1)
    FileName = FileName & "_" + ActiveSheet.Name & ".pdf"
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=FileName
    Set OutlookApp = CreateObject("Outlook.Application")
    Set OutlookMail = OutlookApp.CreateItem(0)
    With OutlookMail
    .To = "jbristow1@gmail.com"
    .CC = ""
    .BCC = ""
    .Subject = "Outlook Code"
    .Body = "Please check and read this document."
    .Attachments.Add FileName
    .Send
    End With
    Kill FileName
    Set OutlookMail = Nothing
    Set OutlookApp = Nothing
    End Sub
    • To post as a guest, your comment is unpublished.
      SomeOneVBA · 6 years ago
      Jim,

      You need to add ; behind the email address and add an other, see example below :

      .To = "jbristow1@gmail.com; someone@gmail.com; onemoreperson@gmail.com"
  • To post as a guest, your comment is unpublished.
    ogunyemi · 7 years ago
    I have attached send to mail recipient, but is not activated when i click to send the excel. What am i doning wrong?
  • To post as a guest, your comment is unpublished.
    Niti Trivedi · 7 years ago
    Hi I want to send only selected cells through a command button in excel to receipts through outlook.
  • To post as a guest, your comment is unpublished.
    Chanda · 7 years ago
    When I use the VBA code to send as a pdf, the email sends fine, however there is no attachment. What am I doing wrong?

    Thanks,
    Chanda
    • To post as a guest, your comment is unpublished.
      HosWorker · 6 years ago
      Did you get an anser for this? Im also having the same difficulty.
  • To post as a guest, your comment is unpublished.
    Russ Streff · 7 years ago
    How do you add multiple recipients in the second example using VBA code?