html - .HTMLBody - 正文和签名之间的间距
问题描述
我刚刚开始使用 VBA 来批量发送电子邮件,但我遇到了一个问题,因为最后一句和签名之间有一条额外的线。
这是它的外观:
尊敬的示例 2 先生,
消息 1
消息 2
恭喜!
空间
空间
签名
我在不同的论坛上进行了研究,但找不到任何解决方案。
预先感谢您对我们的支持!
这是我正在使用的代码:
Option Explicit
Sub Example()
Dim olApp As Object
Dim olMail As Object
Dim olRecip As Object
Dim olAtmt As Object
Dim iRow As Long
Dim Recip As String
Dim Subject As String
Dim Atmt As String
iRow = 2
Set olApp = CreateObject("Outlook.Application")
Do Until IsEmpty(Cells(iRow, 1))
Recip = Cells(iRow, 1).Value
Subject = Cells(iRow, 3).Value
Atmt = Cells(iRow, 4).Value ' Attachment Path
Set olMail = olApp.CreateItem(0)
With olMail
Set olRecip = .Recipients.Add(Recip)
.Display
.Subject = Subject
.HTMLbody = "<html><body><p>Dear " & Cells(iRow, 2).Value & "," & "<br>" & "<br>" & "message 1" & "<br>" & "<br>" & "message 2" & "<br>" & "<br>" & "Congratulations!" & .HTMLbody
Set olAtmt = .Attachments.Add(Atmt)
olRecip.Resolve
.Save
.Close 1
End With
iRow = iRow + 1
Loop
Set olApp = Nothing
Exit Sub
End Sub'
解决方案
我相信我今天发布了一个有助于解决此问题的答案,您可以在这里找到它 - https://stackoverflow.com/a/70268202/17609669
在此获取签名的代码会删除空格,然后可以使用正常的中断来提供所需的间距。
推荐阅读
- c++ - 在不知道数组大小的情况下分配数组中的元素值
- android - MaterialButton 上的 BadgeDrawable 未显示
- java - java - 如何用java中的unicode替换字符串中的每个表情符号?
- oauth-2.0 - .NET 的 Google OAuth2 客户端库是否支持 access_token 或 refresh_token?
- api - 为什么我在 Stripe Web Hook 测试期间收到 404 错误
- reactjs - 如何使用 useState 将用户输入对象添加到 React 中的数组
- python - 当我的输入数据的形状是 4D 时,为什么我的 Conv2D 模型没有得到 4 维?
- c# - 使用 AutoMapper 将简单 DTP 转换为复杂 DTO
- r - 有条件地对 r 中的动态列求和
- ruby-on-rails - 'rails server' 导致 loadError 'cannot load such file -- bigdecimal.so' local