MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Sending An E-Mail With Excel 97

Posted by Bryan Reid on February 10, 2001 3:07 AM

I am creating a macro with Excel 97 that automatically creates and emails a file to a distribution list using Outlook.

Everything works great if Outlook is running when I run the macro but if not ...... well, it falls over!

I think I need to find some VBA code that will allow me to perform a test to see if Outlook is currently running. If not, well I'll exit the macro after a msgbox appears, if it is present then the code can carry on.

Any ideas on how to test to see if an external program (Outlook) is currently running???

I have tried a few things like running Outlook everytime using the Shell command and I have tried using the AppActivate command but that changes the focus and seems to stop the excel code from continuing until I refocus (manually) on Excel.

Anyway, any ideas????????

Posted by Rick on February 10, 2001 1:10 PM

Sorry I don't know, but I would like to know how to send an e-mail, I can't get mine to fill in the address send to. Could you send the macro you have?

Posted by Bryan Reid on February 11, 2001 1:55 AM

To send a workbook use the SENDMAIL command.

ie. ActiveWorkbook.SendMail recipients:=""

For more info search the VBA help file (Help in the VBA Editor) for the keyword SENDMAIL.