简体   繁体   English

使用 Chrome 从 Outlook 打开特定的 URL

[英]Open specific URL from Outlook with Chrome

Our company use IE as the default browser, but certain application we are working with require chrome.我们公司使用 IE 作为默认浏览器,但我们正在使用的某些应用程序需要 chrome。 since we can't abandon IE, we need to open specific \ certain links with chrome, only with outlook .既然我们不能放弃IE,我们需要用chrome打开特定\某些链接,只能用outlook I tried the following vba, which works great, but open automaticlly.我尝试了以下 vba,效果很好,但会自动打开。

Sub LaunchURL(itm As MailItem)

Dim bodyString As String
Dim bodyStringSplitLine
Dim bodyStringSplitWord
Dim splitLine
Dim splitWord

bodyString = itm.Body
bodyStringSplitLine = Split(bodyString, vbCrLf)

For Each splitLine In bodyStringSplitLine
    bodyStringSplitWord = Split(splitLine, " ")

    For Each splitWord In bodyStringSplitWord
        If Left(splitWord, 7) = "http://" Then
            Shell ("C:\Program Files\Google\Chrome\Application\chrome.exe" & " " & splitWord)
        End If
    Next

Next

Set itm = Nothing

End Sub

Private Sub test()
    Dim currItem As MailItem
    Set currItem = ActiveInspector.CurrentItem
    LaunchURL currItem
End Sub

Is there any way to make this script work when the users clicks the url and not automaticlly?当用户单击 url 而不是自动单击时,是否有任何方法可以使此脚本工作? or therefore any way to make this work when the users read the message (so he can unread and when read it will open when he needs to)?或者因此有什么方法可以在用户阅读消息时使这项工作起作用(这样他就可以未读并且在阅读时会在需要时打开)?

Sorry in advance for my bad english.提前抱歉我的英语不好。

Is there any way to make this script work when the users clicks the url and not automaticlly?当用户单击 url 而不是自动单击时,是否有任何方法可以使此脚本工作?

Nope.没有。 There is no trivial way for getting this working per URL. The Outlook object mode doesn't provide anything for handling hyperlinks clicks.根据 URL 没有任何简单的方法可以使它正常工作。 Outlook object 模式不提供任何处理超链接点击的方法。 The best what you could do is to replace links with your owns and tracking this by navigating to your URLs and then forwarding to the original ones.您可以做的最好的事情是用您自己的链接替换链接并通过导航到您的 URL 然后转发到原始链接来跟踪它。

or therefore any way to make this work when the users read the message (so he can unread and when read it will open when he needs to)?或者因此有什么方法可以在用户阅读消息时使这项工作起作用(这样他就可以未读并且在阅读时会在需要时打开)?

You can handle the SelectionChange event of the Explorer class which is fired when the user selects a different or additional Microsoft Outlook item programmatically or by interacting with the user interface.您可以处理Explorer class 的SelectionChange事件,当用户以编程方式或通过与用户界面交互选择不同或附加的 Microsoft Outlook 项目时,该事件将被触发。 This event also occurs when the user (either programmatically or via the user interface) clicks or switches to a different folder that contains items, because Outlook automatically selects the first item in that folder.当用户(以编程方式或通过用户界面)单击或切换到包含项目的不同文件夹时,也会发生此事件,因为 Outlook 会自动选择该文件夹中的第一个项目。

For inspector windows you may consider handling the Inspectors.NewInspector event which is fired whenever a new inspector window is opened, either as a result of user action or through program code.对于检查器 windows,您可以考虑处理Inspectors.NewInspector事件,该事件在打开新检查器 window 时触发,无论是作为用户操作的结果还是通过程序代码。

If the code runs automatically you probably have it in a rule.如果代码自动运行,则您可能将其包含在规则中。

To run code manually from a button when the item is open:要在项目打开时从按钮手动运行代码:

  • Change LaunchURL to standalone code. LaunchURL更改为独立代码。
    -Drop (itm As MailItem) -Drop (itm As MailItem)
    -Add ActiveInspector.CurrentItem lines from Private Sub test() - 从Private Sub test()添加ActiveInspector.CurrentItem

or或者

  • Remove Private from Private Sub test()Private Sub test()中删除Private

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

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