小编Gil*_*cob的帖子

在outlook中粘贴特定的excel范围

我正在处理我想要自动化的Excel报告,但是,单元格的范围未粘贴在Outlook中.

这是我的代码:

Sub Mail_Selection_Range_Outlook_Body()

Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object

Set rng = Nothing
On Error Resume Next
' Only send the visible cells in the selection.
Set rng = Selection.SpecialCells(xlCellTypeVisible)
Set rng = Sheets("Sheet1").RangeToHtml("D4:D12").SpecialCells(xlCellTypeVisible, xlTextValues)
On Error GoTo 0

If rng Is Nothing Then
    MsgBox "The selection is not a range or the sheet is protected. " & _
           vbNewLine & "Please correct and try again.", vbOKOnly
    Exit Sub
End If

With Application …
Run Code Online (Sandbox Code Playgroud)

excel outlook vba excel-vba

6
推荐指数
2
解决办法
13万
查看次数

标签 统计

excel ×1

excel-vba ×1

outlook ×1

vba ×1