On 24 Mar 2007 13:09:26 -0700, "keri" <ke********@hotmail.comwrote:
>Hi,
I use the below for the user to view their outlook calendar
Sub DisplayInbox()
Dim myolApp As Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Set myolApp = CreateObject("Outlook.Application")
Set myNameSpace = myolApp.GetNamespace("MAPI")
Set myFolder = myNameSpace.GetDefaultFolder(olFolderCalendar)
myFolder.Display
End Sub
I have two problems;
1. This does not check if outlook is already open, so can end up with
2 instances of the program open
2. Outlook is minimised when opened (annoying!) (although this may be
solved by the solution to the above problem.
Many thanks,
This function will return -
0 if Outlook is not installed on the machine
1 if Outlook is installed but not currently running
2 if Outlook is installed and currently running
(modified from code provided by Stephen Lebans)
Function fIsOulookThere() As Integer
' Open the installed Version of MS Outlook
Dim OL As Object
'See if Outlook is running
Err.Clear
' Is Outlook running?
Set OL = GetObject(, "Outlook.Application")
' Error if not running
If Err.Number <0 Then
' Clear Error object
Err.Clear
'Create a new instance of Outlook
Set OL = CreateObject("Outlook.Application")
If Err.Number <0 Then
'not installed
fIsOulookThere = 0
Else
'installed but not running
fIsOulookThere = 1
End If
Else
'yes it is running
fIsOulookThere = 2
End If
If Not IsEmpty(OL) Then Set OL = Nothing
End Function
Wayne Gillespie
Gosford NSW Australia