Try the following code:
Dim Maildb As Object 'The mail database Dim UserName As String 'The current users notes name Dim MailDbName As String 'The current users notes mail database name Dim MailDoc As Object 'The mail document itself Dim AttachME As Object 'The attachment richtextfile object Dim Session As Object 'The notes session Dim EmbedObj As Object 'The embedded object (Attachment) Dim Subject As String 'The subject string Dim Attachment As String 'The path to the attachemnt string Dim Recipient As String 'The Recipient string (or you could use the list) Dim Recip(10) As Variant 'The Recipient list Dim BodyText As String 'The body text Dim SaveIt As Boolean 'Save to sent mail Dim WasOpen As Integer 'Checking to see if the Mail DB was already 'open to determine if session should be 'closed (0) or left alone (1) Dim ClipBoard As DataObject 'Data object for getting text from clipboard Subject = "This is a Test Email Messag" Recipient = "harmeet_si...@gmail.com" Sheets("Sheet1").Select Range("A1").CurrentRegion.Select Selection.Copy Set ClipBoard = New DataObject ClipBoard.GetFromClipboard SaveIt = True Set Session = CreateObject("Notes.NotesSession") UserName = Session.UserName MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf" Set Maildb = Session.GetDatabase("", MailDbName) If Maildb.IsOpen = True Then WasOpen = 1 'Already open for mail Else WasOpen = 0 Maildb.OpenMail 'This will prompt you for password End If Set MailDoc = Maildb.CreateDocument MailDoc.Form = "Memo" MailDoc.SendTo = Recipient 'Or use Racip(10) for multiple MailDoc.Subject = Subject MailDoc.Body = ClipBoard.GetText(1) MailDoc.SaveMessageOnSend = SaveIt If Attachment <> "" Then Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment") Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "Attachment") MailDoc.CREATERICHTEXTITEM ("Attachment") End If MailDoc.PostedDate = Now() 'Gets the mail to appear in the sent items folder MailDoc.Send 0, Recipient 'Clean Up' Range("A1").Select Application.CutCopyMode = False Set Maildb = Nothing Set MailDoc = Nothing Set AttachME = Nothing Set EmbedObj = Nothing If WasOpen = 1 Then Set Session = Nothing ElseIf WasOpen = 0 Then Session.Close Set Session = Nothing End If MsgBox "The Line Down Email was sent", vbOKOnly place this code into a sub function & then put your data in sheet1. let me know if that helps On Tue, Feb 17, 2009 at 3:23 AM, <humtumhareh...@gmail.com> wrote: > > Private Sub CommandButton1_Click() > > agentname = Sheet1.Cells(1, 1) > Dim oWrkSpace As Object > Dim oCrntDoc As Object > > Set oWrkSpace = CreateObject("Lotus.NotesSession") > Set oCrntDoc = oWrkSpace.currentDocument > > Call oCrntDoc.FieldSetText("EmailSentTo", "murtaza") > Call oCrntDoc.FieldSetText("EnterCopyTo", sCopyTo) > Call oCrntDoc.FieldSetText("Immediate Feedback", sSubject) > > Call oCrntDoc.FieldAppendText("Hi All" + vbNewLine + "Please find > attached the Immediate feedback tracker for " + agentsname + " and > please revert for any clarifications or suggestions", vbNewLine & > sBody) > > Call oCrntDoc.GoToField("body") > Call oCrntDoc.Paste > Call oCrntDoc.Save(True, False, False) > Call oCrntDoc.Send(True) > > Set oCrntDoc = Nothing > Set oWrkSpace = Nothing > > AppActivate ("Notes") > End Sub > > i tried to modify the code a little bit and this is wat i did. Can you > help me more with it? > > > On Feb 13, 1:16 am, Dev <nvdev.i...@gmail.com> wrote: > > This is not tested...Just pulled from my memory. The below script > > combines both vba and lotus script. More faster and elegant. > > > > Dim oWrkSpace As Object > > Dim oCrntDoc As Object > > > > Set oWrkSpace = CreateObject ("Notes.NotesUIWorkSpace") > > Set oCrntDoc = oWrkSpace.CurrentDocument > > > > Call oCrntDoc.FieldSetText("EnterSendTo", sEmailId) > > Call oCrntDoc.FieldSetText("EnterCopyTo", sCopyTo) > > Call oCrntDoc.FieldSetText("Subject", sSubject) > > > > Call oCrntDoc.FieldAppendText("Body", vbNewLine & sBody) > > > > Call oCrntDoc.GoToField("Body") > > Call oCrntDoc.Paste > > Call oCrntDoc.Save(True, False, False) > > Call oCrntDoc.Send(True) > > > > Set oCrntDoc = Nothing > > Set oWrkSpace = Nothing > > > > AppActivate ("Notes") > > > > Hope this helps! > > > > Thank you, > > Dev > > > > On Feb 12, 4:26 am, Darshan Amreliya <amreliya1...@gmail.com> wrote: > > > > > > > > > Hi > > > I required a macro to send a email via Lotus notes using excel > > > > > Please do the needful asap > > > -- > > > Regards > > > > > Darshan Amreliya- Hide quoted text - > > > > - Show quoted text - > > > > --~--~---------~--~----~------------~-------~--~----~ Visit the blog to download Excel tutorials at http://www.excel-macros.blogspot.com To post to this group, send email to excel-macros@googlegroups.com For more options, visit this group at http://groups.google.com/group/excel-macros?hl=en Visit & Join Our Orkut Community at http://www.orkut.com/Community.aspx?cmm=22913620 To Learn VBA Macros Please visit http://www.vbamacros.blogspot.com To see the Daily Excel Tips, Go to: http://exceldailytip.blogspot.com If you find any spam message in the group, please send an email to Ayush @ jainayus...@gmail.com -~----------~----~----~----~------~----~------~--~---