• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macro to send mail from Excel

Hi,


I wrote a macro for sending mails from excel sheet as attachment.


below is the code:


Sub Mail_workbook_1()

Dim wb As Workbook

Dim I As Long


Set wb = ActiveWorkbook


If Val(Application.Version) >= 12 Then

If wb.FileFormat = 51 And wb.HasVBProject = True Then

MsgBox "There is VBA code in this xlsx file, there will be no VBA code in the file you send." & vbNewLine & _

"Save the file first as xlsm and then try the macro again.", vbInformation

Exit Sub

End If

End If


On Error Resume Next

For I = 1 To 3


wb.SendMail Worksheets("Start").Range("e39").Value, _

"Voice of Customer 2012!"


If Err.Number = 0 Then Exit For

Next I

On Error GoTo 0


End Sub


Problem: this macro is working in OutLook only. But i need this to work in any mail like Lotus etc.,


Please help me on this.


Regards,

Kumar.
 
I had tried sending emails through Lotus Notes.


LN email can be sent by three distinct methods:

1. Lotus COM

2. Lotus OLE Automation (a. Through Notes.NoteSession b. Notes.NotesUIWorkspace)


Luke has provided you an excellent link which uses option 2a. Dennis Wallentin has written them and he has covered a whole lot of options. I had also tried my hand and I had used option 1. See the link below:

http://www.vbaexpress.com/forum/showthread.php?t=35917


However, I will recommend you use IBM Redbook for reference where the concepts have been explained in detail.

COM Redbook: http://www.redbooks.ibm.com/redbooks/pdfs/sg245670.pdf

OLE Redbook: http://www.redbooks.ibm.com/redbooks/pdfs/sg244856.pdf


Good Luck!
 
Back
Top