Excel crashes on closing after SendMail

A

azhukovsky

Hi Everyone,

the following code:

Set apExcel = New Excel.Application
With apExcel
.Workbooks.Open App.Path & "\test.xls"
.Workbooks(1).SendMail "(e-mail address removed)", "Test"
.Workbooks(1).Close
.Application.Quit
End With
Set apExcel = Nothing


causes Excel to crash on closing (.Application.Quit). The mail is
getting sent successfully.

If I comment .SendMail line, everything works just fine.

I do not know if this info is relevant, but
I am using Thundebird Email and have McAfee virus scan which blocks
port 25 for mass mailing.


Please help,

Alex
 
P

Peter T

I haven't tried your code but effectively you are doing this

apExcel.Application.Quit

Try removing the .Application. Also probably better to move it outside the
With - End With, ie

apExcel.Quit

Regards,
Peter T
 

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