I have some simple code that checks for the presence of Outlook, and if it's not already running then it launches it. Problem is that it then won't return to Access and continue execution of the code unless I manually return focus to either the VBA editor or Access itself, then it continues on as if nothing went wrong and compiles the email as per normal.
Here is the code I'm using currently, if anyone has a better way to achieve the same end please let me know. I don't want to roll out my project like this, as users may see this and think that the DB has crashed on them. (And I'll get inundated with phonecalls!
)
Any help greatly appreciated. I've tried everything I can think of today, but I've not made any progress.
Cheers,...Jon.
Here is the code I'm using currently, if anyone has a better way to achieve the same end please let me know. I don't want to roll out my project like this, as users may see this and think that the DB has crashed on them. (And I'll get inundated with phonecalls!
Code:
On Error Resume Next
Set objOutlook = GetObject(, "Outlook.Application")
If Err.Number = 429 Then
Shell "C:\Program Files (x86)\Microsoft Office\Office12\Outlook.exe", vbNormalNoFocus
[COLOR=darkgreen]'This is where it stops processing and sits waiting for user intervention.[/COLOR]
Err.Clear
While objOutlook.Name <> "Outlook"
Set objOutlook = GetObject(, "Outlook.Application")
Wend
Err.Clear
objOutlook.ActiveWindow.WindowState = olMinimized
ElseIf Err.Number <> 0 Then
GoTo Err_RequestChangeEmail_Click
End If
On Error GoTo Err_RequestChangeEmail_Click
Any help greatly appreciated. I've tried everything I can think of today, but I've not made any progress.
Cheers,...Jon.