【发布时间】:2015-02-05 22:07:12
【问题描述】:
我正在尝试构建一个宏,该宏从 Excel 电子表格中抓取选定的单元格,将单元格粘贴到新的 Outlook 电子邮件中,然后更改单元格的格式。
具体我想把表格转成文字,然后把字体改成Arial size 10。
下面的代码做了上面的,但是我一直没搞清楚怎么把表格转成文字,然后再改文字字体。
有人可以帮忙吗?
Sub Email_test()
Dim rng As Range
Dim OutApp As Object
Dim OutMail As Object
Set rng = Nothing
Set rng = Sheets("Master").Range("A1:B99").SpecialCells(xlCellTypeVisible)
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
.EnableEvents = False
.ScreenUpdating = False
End With
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = "User@company.com"
.CC = ""
.BCC = ""
.Subject = "Cells as text "
.HTMLbody = RangetoHTML(rng)
' In place of the following statement, you can use ".Display" to
' display the e-mail message.
.Display
End With
End Sub
【问题讨论】:
标签: excel text outlook excel-2010 vba