【发布时间】:2021-05-28 10:31:21
【问题描述】:
如何测试 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 以绕过打开。
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
【讨论】: