Hi!
I did a program with excel and i want to send mail automatically by netscape (no choice) to tell if the program fail or not. I know about mapi32 and shell but i am a beginner. Is someone can help me ???
This routine will look at 3 cells within Excel and send a message with an attachment. Sorry, I don't know how to send just a message, but sending a blank xls file is no big deal.
C5=Full email address (JohnSmith@msn.com)
C6=Full path to file attachment (C:\Temp\Blank.xls)
C7=Text message (The routine ran OK) or (Something wrong)
You can create a formula that states what you want.
--------------------------------------------------------
Sub EMailFile()
Application.ScreenUpdating = False ' smooth out macro execution
Range("C5".Select ' Start here, where C5=MailWho, C6=MailFile, C7=MailMessage
MailWho = Selection.Range("A1" ' get WHO value from current cursor cell
MailFile = Selection.Range("A2" ' get FILE from current cell + 1 row down
MailMessage = Selection.Range("A3" ' get MESSAGE from current cell + 2 rows down
Workbooks.Open FileName:=MailFile, ReadOnly:=True, UpdateLinks:=0 ' Open the file
ActiveWorkbook.SendMail Recipients:=MailWho, Subject:=MailMessage ' Send it
ActiveWorkbook.Close (False) ' Close and NO SAVE !
Windows("MasterFile.xls".Activate 'Now go back to Main file
End Sub
--------------------------------------------------------
I wasn't sure what you mean by "Netscape (no choice)", but I think the above routine will work with whatever has been set as your default Email.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.