You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在邮件正文的"1."前后添加制表符/空格?已试空格及Space(10)

嘿,我来帮你搞定邮件正文里给"1."前后加空格/制表符的问题!

你之前用普通空格或者Space(10)没效果,核心原因是HTML渲染时会自动合并多个连续的普通空格——哪怕你在VBA里拼了很多空格,最终到邮件的HTML正文里都会被缩成一个,自然达不到你想要的缩进效果。

给你几个可行的解决方案,直接修改你的VBA代码就行:

方案1:用HTML非换行空格( )

这是最常用的方法,每个 代表一个不会被合并的空格,你可以根据需要加多个:

sBodyStart = "<font size=""3"" face=""Calibri"" color=""black"">" & _
             "Good Afternoon," & "<br>" & "<br>" & vbCrLf & vbCrLf & _
             "Please confirm and acknowledge the below by responding with the appropriate voting button." & "<br>" & "<br>" & _
             "&nbsp;&nbsp;&nbsp;&nbsp;1. Do not share this information." & "<br>" & "<br>" & _ ' 前面加4个非换行空格
             "Please provide a response to this email using the voting buttons, no later than September 20, 2019. If you have any questions, please do not hesitate to reach out." & "<br>" & "<br>" & "<br>" & vbCrLf & vbCrLf & _
             "</font>"

方案2:用HTML制表符实体(&#9;)

如果想要更像键盘Tab键的缩进效果,可以用&#9;:

sBodyStart = "<font size=""3"" face=""Calibri"" color=""black"">" & _
             "Good Afternoon," & "<br>" & "<br>" & vbCrLf & vbCrLf & _
             "Please confirm and acknowledge the below by responding with the appropriate voting button." & "<br>" & "<br>" & _
             "&#9;1. Do not share this information." & "<br>" & "<br>" & _ ' 前面加一个制表符
             "Please provide a response to this email using the voting buttons, no later than September 20, 2019. If you have any questions, please do not hesitate to reach out." & "<br>" & "<br>" & "<br>" & vbCrLf & vbCrLf & _
             "</font>"

方案3:用CSS样式精确控制间距(更灵活)

如果需要更精准的间距大小,可以用<span>标签配合CSS的padding或margin:

sBodyStart = "<font size=""3"" face=""Calibri"" color=""black"">" & _
             "Good Afternoon," & "<br>" & "<br>" & vbCrLf & vbCrLf & _
             "Please confirm and acknowledge the below by responding with the appropriate voting button." & "<br>" & "<br>" & _
             "<span style='padding-left: 20px;'>1. Do not share this information.</span>" & "<br>" & "<br>" & _ ' 左边加20px间距
             "Please provide a response to this email using the voting buttons, no later than September 20, 2019. If you have any questions, please do not hesitate to reach out." & "<br>" & "<br>" & "<br>" & vbCrLf & vbCrLf & _
             "</font>"

你可以根据自己想要的缩进效果选其中一种,测试一下就能看到符合预期的排版啦!

内容的提问来源于stack exchange,提问作者rauf741

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.14 07:30:26