简体   繁体   English

使用VBA的Outlook电子邮件的索引超链接

[英]Indexed Hyperlinks for Outlook Email Using VBA

I'm Trying to create a macro where I want an index list which could jump to specific header tags in the same email page. 我正在尝试创建一个我想要一个索引列表的宏,该列表可以跳转到同一电子邮件页面中的特定标头标签。

I have tired using anchor elements and id's, but it is not working. 我已经厌倦了使用锚元素和id的操作,但是它不起作用。

Here is my code. 这是我的代码。

Could you please let me know how I can solve the issue at hand? 您能告诉我如何解决当前问题吗?

With MailItem: 使用MailItem:

    .BodyFormat = olFormatHTML
    .Display
    .HTMLBody = "<a href='#section1'>CS Brazil Lineup vs Balance Sheet Demand -Sept'18</a>" _
    & "<br>" & "<h3 name = 'section_1'><span style='background-color: #FFFF00'><font color='blue'>Regional LU</font></span></h3>" _
    & "<br>" & "<img src='C:\Users\ramesn1\Documents\New folder\Regional Line up Sugar.png'\>" _
    & "<br>" & "<h3 id = 'Section2'><span style='background-color: #FFFF00'><font color='blue'>Unknowns for the moment for Sept : 169kmt</font></span></h3>" _
    & "<br>" & "<img src=''\>" _
    & "<br>" & "<h3 name = 'Section3'><span style='background-color: #FFFF00'><font color='blue'>CS Brazil Lineup vs Balance Sheet Demand " & MonthYear & "</font></span></h3>" _
    & "<br>" & "<img src='C:\Users\ramesn1\Documents\New folder\workSugar.png'\>" _
    & "<br>" & "<h3 id = 'Section4'><span style='background-color: #FFFF00'><font color='blue'>Next 7 Months Destination Demand</font></span></h3>" _
    & "<br>" & "<img src='C:\Users\ramesn1\Documents\New folder\workForecast.png'\>" _
    & "<br>" & "<h3><span style='background-color: #FFFF00'><font color='blue'>% Representation of Total Exports for 1st Day " & MonthYear & "</font></span></h3>" _
    & "<br>" & "<img src='C:\Users\ramesn1\Documents\New folder\1st date demandTable1.png'\>" _
    & "<br>" & "<img src='C:\Users\ramesn1\Documents\New folder\1st date demandTable2.png'\>" _
    & "<br>" & "<h3><span style='background-color: #FFFF00'><font color='blue'>Terminal Capacity/Waiting Time </font></span></h3>" _
    & "<br>" & "<img src='C:\Users\ramesn1\Documents\New folder\QUEUE.png'\>" _
    & "<br>" & "<h3><span style='background-color: #FFFF00'><font color='blue'>CS LU Nominations to be Shipped  Sugar + Other commodities (YoY)</font></span></h3>" _
    & "<br>" & "<img src='C:\Users\ramesn1\Documents\New folder\CS(YOY)Chart 1.png'\>" _
    & "<br>" & "<img src='C:\Users\ramesn1\Documents\New folder\CS(YOY)Chart 3.png'\>" _
    & "<br>" & "<h3><span style='background-color: #FFFF00'><font color='blue'>Terminal Performance & Nominations for G&O +Sugar -" & PreviousMonth & " & " & MonthYear & " </font></span></h3>" _
    & "<br>" & "<img src='C:\Users\ramesn1\Documents\New folder\Lineup ProgressAll Commodities.png'\>" _
    & "<br><br>" _
    & "<br>" & "<img src='C:\Users\ramesn1\Documents\New folder\Lineup ProgressGrains.png'\>" _
    & "<br><br>" _
    & "<br>" & "<img src='C:\Users\ramesn1\Documents\New folder\Lineup ProgressSugar.png'\>"

As destination you have to user the tag . 作为目的地,您必须使用标签。

you have to put 你必须把

<a name="section1" id="section1">

its better to put both name and id because the mail clients have distinct ways to process the anchors. 最好同时输入名称和ID,因为邮件客户端有不同的方式来处理锚点。

Also, you have to pay attention to the fact that some clients simply ignore or block the anchors. 此外,您还必须注意某些客户端只是忽略或阻止锚点这一事实。

good luck 祝好运

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM