+ Reply to Thread
Results 1 to 2 of 2

Send an attachment through Lotus Notes

Hybrid View

just_some_guy Send an attachment through... 07-01-2010, 11:47 AM
just_some_guy Re: Send an attachment... 07-01-2010, 12:37 PM
  1. #1
    Forum Contributor
    Join Date
    03-02-2010
    Location
    Denver, CO
    MS-Off Ver
    Excel 2010
    Posts
    109

    Send an attachment through Lotus Notes

    Hi,

    I'm currently working on a macro that will open an e-mail with a pre-assigned recipient, subject line, and body for text. But I'm running into trouble.

    I recorded the macro for opening my e-mail and attaching the document, but no matter what I try, I can't get the recipient, subject line, or body to fill out.

    Any ideas?

    Thanks for your help.

  2. #2
    Forum Contributor
    Join Date
    03-02-2010
    Location
    Denver, CO
    MS-Off Ver
    Excel 2010
    Posts
    109

    Re: Send an attachment through Lotus Notes

    I found the following code, but I cannot get it to work.

    
     Dim username As String, maildbname As String, recipient As String, attachment1 As String
        Dim maildb As Object, maildoc As Object, attachme As Object, session As Object
        Dim embedobj1 As Object
        
        With Application
            .ScreenUpdating = False
            .DisplayAlerts = False
            
            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
            Else
                maildb.OPENMAIL
            End If
            
            Set maildoc = maildb.createdocument
            maildoc.form = "memo"
            recipient = Sheets("8D Short Form").Range("a2").Value
            
            maildoc.Subject = Sheets("8D Short Form").Range("z3").Value
            maildoc.body = Sheets("8D Short Form").Range("z4").Value
            
            maildoc.savemessageonsend = True
            MsgBox ActiveWorkbook.Name
                attachment1 = ActiveWorkbook.Name
            
            If attachent1 <> "" Then
                On Error Resume Next
                    Set attachme = maildoc.createrichtextitem("attachment1")
                    Set embedobj1 = attachme.embedobject(1454, "attachment1", ActiveWorkbook.Name, "")
                On Error Resume Next
            End If
            
            maildoc.posteddate = Now()
                On Error GoTo errorhandler1
            maildoc.send 0, recipient
            
            Set maildb = Nothing
                Set maildoc = Nothing
                    Set attachme = Nothing
                Set session = Nothing
            Set embedobj1 = Nothing
                
            .ScreenUpdating = True
            .DisplayAlerts = True
        End With
        
    errorhandler1:
        
            Set maildb = Nothing
                Set maildoc = Nothing
                    Set attachme = Nothing
                Set session = Nothing
            Set embedobj1 = Nothing
    I run into two problems. First, if I have my email account open, it gets to the point where it shows the pop up message, but does not actually open, fill out, or send the e-mail.

    Second, if my email is not open, it starts to open the e-mail and excel throws up the following error message:

    Run-time error '8965':
    The ID File is in use elsewhere and cannot be modified.

    Any ideas?

    Thanks again.

+ 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