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.
Bookmarks