Is it possible to close outlook prior to running code?

rnickels

Registered User.
Local time
Today, 07:08
Joined
Dec 8, 2006
Messages
48
Hello,

I have the following code to send a report via outlook.

Private Sub OLEUnbound238_Click()
DoCmd.SendObject ObjectType:=acSendReport, ObjectName:="Statement One Player", OutputFormat:=acFormatHTML, To:=Me!Email, Subject:="Rob Nickels Tennis", MessageText:="This is a friendly reminder that payment for tennis classes is now due. Kindly remember that payment for tennis classes are due by the 7th. Please find attached your invoice. Thank you.", EditMessage:=False
DoCmd.Close acForm, "E-mail Statement?", acSaveYes
DoCmd.OpenForm "Client Information Main Info Form", acNormal
End Sub

This works great if Outlook is not currently open, but if Outlook is open then I receive an error messgae and the e-mail does not get sent.

My question is this. Can I add some VB code to the above code that closes outlook IF it is already open?

I am using Access 2003.

Thanks in advance,
Rob
 

Users who are viewing this thread

Back
Top Bottom