+ Reply to Thread
Results 1 to 2 of 2

HELP! Lotus Notes mailing bug!!

Hybrid View

  1. #1
    Registered User
    Join Date
    11-27-2004
    Posts
    3

    Unhappy HELP! Lotus Notes mailing bug!!

    Hello,

    Please help me with this one! I am desperately in need of a solution that will let me send a mail from an excel file to a Lotus Notes ID with the same excel file or any other excel file as an attachment.

    I have tried using this code by mathew_guilbault from another Excel forum. But it only sends the message, not the attachment:

    Sub SendMail()

    Dim Maildb As Object, UserName As String, MailDbName As String
    Dim MailDoc As Object, Session As Object
    Dim tmax As String

    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 Then
    Else: Maildb.OpenMail
    End If
    Set MailDoc = Maildb.CreateDocument
    MailDoc.Form = "Memo"
    Recipients = "xyz@abc.com"
    MailDoc.sendto = Recipients
    'Nickname or full address
    'MailDoc.CopyTo = Whomever
    'MailDoc.BlindCopyTo = Whomever
    MailDoc.Subject = "====> Test Mail - Please do not reply!! <===="
    MailDoc.Body = _
    Replace("Hi! Hope this mail arrives with an attachment!" _
    & [b65536].End(3) & "Have a nice day!", "!", vbCrLf)

    ' Select Workbook to Attach to E-Mail

    MailDoc.SaveMessageOnSend = True

    tmax = ActiveWorkbook.Name
    attachment1 = tmax

    If attachment1 <> "" Then
    On Error Resume Next
    Set AttachME = MailDoc.CREATERICHTEXTITEM("attachment1")
    Set EmbedObj1 = AttachME.embedobject(1454, "attachment1", tmax)
    On Error Resume Next
    End If

    MailDoc.PostedDate = Now
    On Error Resume Next
    Call MailDoc.Send(False)
    Session.Quit
    Set Maildb = Nothing: Set MailDoc = Nothing: Set Session = Nothing

    MsgBox ("message sent")

    End Sub


    I am on the brink of a nervous breakdown here!! Please help.....

    Thanks a million in advance,

    Mister Macro

  2. #2
    Registered User
    Join Date
    02-24-2005
    Posts
    11

    Smile

    I know how you feel! Been there, done that, and will probably be there later today.

    You need to define attachment1 with the full file path and workbook/attachment name. As long as the ActiveWorkbook has been saved you can use ActiveWorkbook.FULLName.

    Or hard code the path and use .name - "C:\My Documents\Excel WBs\" & ActiveWorkbook.Name

    You also want to make sure you have defined AttachMe and EmbedObj as objects.

    I hope this helps!
    Last edited by datagopher; 02-25-2005 at 05:56 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1