vba 在 vba 电子邮件正文中添加多个空格?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26377599/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
vba add more than one space in vba email body?
提问by Hyman Knight
I am using vba in outlook to generate an email. I would like to find a way to move some text over to the right, about 100 pixels.
我在 Outlook 中使用 vba 来生成电子邮件。我想找到一种方法将一些文本向右移动,大约 100 像素。
since I don't believe there is a way to incorporate css or styles in vba I am looking for a way to add more than one space to get the text moved over. however when I try space() function and " ", even if I repeat these codes a number of times it only ever gives me one space.
因为我不相信有一种方法可以在 vba 中合并 css 或样式,所以我正在寻找一种方法来添加多个空格来移动文本。然而,当我尝试 space() 函数和“”时,即使我多次重复这些代码,它也只会给我一个空格。
can someone please help me and show me what I need to do, thanks
有人可以帮助我并告诉我我需要做什么,谢谢
"<br><br><br>" & "3PL & HAULAGE SUPPLIERS: " & " " & "<font size=""4.5"" face=""calibri"" color=""red"">" & "<b>" & EmailCount & "</b></font>" & vbNewLine & _
回答by Mark Price
This will add 10 white spaces just before 3PL. You may need to adjust as the pixel distance will be relative to the font
这将在 3PL 之前添加 10 个空格。您可能需要调整,因为像素距离将相对于字体
TRIED AND TESTED
久经考验
Sub test()
Dim WS As String
WS = " "
For i = 1 To 10
WS = WS & " "
Next i
Debug.Print "<br><br><br>" & WS & "3PL & HAULAGE SUPPLIERS: " & " " & "<font size=""4.5"" face=""calibri"" color=""red"">" & "<b>" & EmailCount & "</b></font>" & vbNewLine
End Sub