通过带有项目符号的 VBA 的 HTML 电子邮件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42202131/
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
HTML Email via VBA with bullets
提问by Dames
I am struggling to get my HTML formatting correct on an automated email generated through VBA. I have never used HTML before in my life, so this is a totally new thing for me... I have tried to research online already but I just can't make sense of this.
我正在努力在通过 VBA 生成的自动电子邮件中正确设置 HTML 格式。我以前从未使用过 HTML,所以这对我来说是一个全新的东西......我已经尝试过在线研究,但我无法理解这一点。
.HTMLBody = "<style> body{color:black;font-family:Calibri;font-size: 11pt;}" & "<HTML><body>Dear " & Addressee & ",<br><br>As you would be aware, the...<br><br>Please find attached spreadsheet showing:<br><br> — Example list 1. <br> — Example list 2. <br> — Example list 3.<br><br> <b>Kindly reply to ALL indicating...</b><br><br> Regards,<br><br>" & Signature
The problem with the above is that it doesn't automatically indent the lines if they subsequently move into a second row as I have "created" fake bullets. Also, this code above is terribly basic (reflecting my lack of understanding :/) - but I essentially want to find a way to have a bunch of text, list 3 bullets keeping all the formatting as would be in the case of normal bullets (i.e. indent the lines) and then have a conclusion and normal end of email.
上面的问题是,如果它们随后移动到第二行,它不会自动缩进,因为我已经“创建”了假子弹。此外,上面的代码非常基本(反映我缺乏理解:/)-但我本质上想找到一种方法来拥有一堆文本,列出 3 个项目符号,保留所有格式,就像在普通项目符号的情况下一样(即缩进行),然后有一个结论和电子邮件的正常结尾。
Any chance someone will be able to assist me with the HTML code to have bullets..? I have cleared out a lot of the text in the above code due to confidential information.
任何人都可以帮助我使用 HTML 代码来获得子弹..?由于机密信息,我已经清除了上面代码中的很多文字。
Thank you!
谢谢!
回答by Jordan
You want to use an Ordered Listwhich uses the layout of:
您想使用使用以下布局的有序列表:
<ol>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>
Where the <ol>
tag stands for Ordered List and the <li>
tags stand for List Item. The above code produces the following:
其中<ol>
标签代表有序列表,<li>
标签代表列表项。上面的代码产生以下内容:
- Item 1
- Item 2
- Item 3
- 第 1 项
- 第 2 项
- 第 3 项
Alternatively, if you don't want numbers and just want bullet points you can use an Unordered List which uses the same layout except the <ol>
tag changes to <ul>
:
或者,如果您不想要数字而只想要项目符号,您可以使用无序列表,该列表使用相同的布局,但<ol>
标签更改为<ul>
:
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
And looks like this:
看起来像这样:
- Item 1
- Item 2
- Item 3
- 第 1 项
- 第 2 项
- 第 3 项