E-Mail through Outlook error

B

Beetle

I am using a command button on a form to open Outlook to send an e-mail
to the current customer. It does exactly what I need, except that if Outlook
is already open, but is minimized, the e-mail editor opens but remains
minimized
along with Outlook. Winging it, I decided to try adding a .Maximize, which
does
work, but it throws an error 438;

"Object does not support this property or method"

Here is my current code;

Private Sub cmdEMailCustomer_Click()
On Error GoTo HandleError

If Nz(Me.EMail, "") = "" Then
MsgBox "No e-Mail address on file for this customer"
Exit Sub
End If

Dim appOutlook As Outlook.Application
Dim Msg As Object

Set appOutlook = GetObject(, "Outlook.Application")
Set Msg = appOutlook.CreateItem(olMailItem)

With Msg
.To = Me.EMail
.Display
.Maximize << this line works, but throws the error
End With

Exit_Procedure:
Set appOutlook = Nothing
Exit Sub

HandleError:
If Err.Number = 429 Then
Set appOutlook = CreateObject("OutLook.Application")
Resume Next
End If
ErrorHandler Err.Number, Err.Description, "frmCustomers",
"cmdEMailCustomer_Click"
Resume Exit_Procedure

End Sub

Should I just trap for the error and ignore it, or should I be doing
something different?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top