如何测试 Outlook 以绕过打开。
if outlook.application "is available" then
'run the command for sending an email
else
'open/display the current users document folder
end if
'do some stuff...
以下代码首先检查 Outlook 是否已在运行。如果是,则将该应用程序分配给 olApp。如果没有,它将启动应用程序(如果可用)并将其分配给 olApp。
Dim olApp As Object
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
If olApp Is Nothing Then
Set olApp = CreateObject("Outlook.Application")
End If
On Error GoTo 0
If Not olApp Is Nothing Then
'run the command for sending an email
Else
'open/display the current users document folder
End If
'do some stuff...
Set olApp = Nothing
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)