VBA to open Outlook

Got it!

Code:
Dim objOutlook As Object
 
On Error Resume Next
Set objOutlook = GetObject(,"Outlook.Application")
objOutlook.ActivateWindow.WindowState = 1
If Err <> 0 Then
Call Shell (acSysCmdAccessDir) & "OUTLOOK.EXE")
End If
 
Pause (5#)
 
Set objOutlook = GetObject(,"Outlook.Application") 'probably not needed, but belts and braces
 
With objOutlook
objOutlook.ActiveWindow.WindowState = 1
End With
Set objOutlook = Nothing
 
End Sub

I had to put the pause function in as it would not minimise Outlook on instances that had been opened by the db - presumably as Outlook was still opening it wasn't in a state to take the minimise command? Either way, it works, so I am happy :)

I also removed the reference to the MS Outlook 14.0 object library too, and everything still works - - email won't open on an XP/Office 2003 machine but I couldn't give a monkey's about that as they are in the minority and will be gone in a matter of weeks. At least I don't need a separate version of the FE for XP users now.

Our IT department are reasonably flexible, and willing, however the skill set may not be able to compete with their willingness at the moment - - I will say no more.

OK - off to do me a splash screen now :)

Thanks again!
 

Users who are viewing this thread

Back
Top Bottom