电子邮件到达时如何启动URL [英] How to launch a URL when an email arrives

查看:122
本文介绍了电子邮件到达时如何启动URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当电子邮件到达Outlook时,我想启动一个URL.我设置了一条规则,并使其触发了脚本功能.看来我想调用ShellExecute在浏览器中启动URL,但是当我点击以下行时:

I would like to launch a URL when an email arrives in Outlook. I setup a rule and have it trigger a script function. It looks like I want to call ShellExecute to launch the URL in a browser, but when I hit this line:

    ShellExecute(0&, "open", URL, vbNullString, vbNullString, _
vbNormalFocus)

该方法未定义.有什么想法吗?

The method is not defined. Any ideas?

推荐答案

ShellExecute是Windows dll中的函数. 您需要在VBA模块中为此添加一个声明:

ShellExecute is a function in a windows dll. You need to add a declaration for it like this in a VBA module:

Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" ( _
    ByVal hWnd As Long, _
    ByVal lpOperation As String, _
    ByVal lpFile As String, _
    ByVal lpParameters As String, _
    ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long      

您的Shell解决方案与ShellExecute之间的区别在于ShellExecute将使用默认的URL系统处理程序来打开链接.这不必是IE.您的解决方案将始终在IE中打开它.您的操作相当于将iexplore.exe放入Windows的运行框中. ShellExecute等效于将url放入Windows的运行框中.

The difference between your Shell solution and ShellExecute is that ShellExecute will use the default system handler for URLs to open the link. This doesn't have to be IE. Your solution will always open it in IE. Yours is the equivalent of putting iexplore.exe into the run box in windows. ShellExecute is the equivalent of just putting the url in the run box in windows.

这篇关于电子邮件到达时如何启动URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆