Detect Outlook
(from Italy)
Great! But:
1. I check if Outlook is installed on my pc
==============
Function ApplicationIsAvailable(ApplicationClassName As String) As Boolean
Dim AnyApp As Object
On Error Resume Next
Set AnyApp = CreateObject(ApplicationClassName)
ApplicationIsAvailable = Not AnyApp Is Nothing
Set AnyApp = Nothing
On Error GoTo 0
End Function
==============
2. I check if Outlook is running
==============
Function ApplicationIsRunning(ApplicationClassName As String) As Boolean
Dim AnyApp As Object
On Error Resume Next
Set AnyApp = GetObject(, ApplicationClassName)
ApplicationIsRunning = Not AnyApp Is Nothing
Set AnyApp = Nothing
On Error GoTo 0
End Function
==============
3. which is the VBA code in order to say to Excel: pls bring Outlook frontward
With my poor skills I'0m using the command AppApplication that requires the
name in the Application title bar and not the program name (in the specific
it require "Inbox - Microsoft Outlook" and not "Outlook.exe").
==============
Private Sub myBtn_Click()
If Not ApplicationIsAvailable("Outlook.Application") Then Exit Sub
If ApplicationIsRunning("Outlook.application") = True Then
AppActivate "Inbox - Microsoft Outlook" <==== ???????
Else
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
myFolder.Display
End If
End Sub
==============
Thanks
--
Sergiovery
"Pete" wrote:
brilliant, thanks
|