|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
在网上找到如下VBA码可在邮件内文插入附件资讯,可是插入点却是在邮件尾,如何修改可以将资讯于游标停留点插入?谢谢!
[code=vb]Option Explicit
Sub Names()
Dim Atmt As attachment
Dim Mensaje As Outlook.MailItem
Dim Adjuntos As String
Dim Body As String
Dim i As Integer
Set Mensaje = Application.ActiveInspector.currentItem
Mensaje.BodyFormat = olFormatHTML
Body = Mensaje.HTMLBody
i = 0
Adjuntos = ""
For Each Atmt In Mensaje.Attachments
'If Atmt.Size > 5 Then
Adjuntos = Adjuntos & "** Attached file: <u>" & Atmt.FileName & "</u><br>"
i = i + 1
'End If
Next Atmt
Adjuntos = "<font face='calibri'><u><b>Total number of attached files: " & i & "</u></b><br>" & Adjuntos & "</font>"
Mensaje.HTMLBody = Left(Body, InStr(Body, "</body>") - 1) & Adjuntos & Right(Body, Len(Body) - InStr(Body, "</body>") + 1)
Set Mensaje = Nothing
End Sub
[/code]
|
|