You're in luck. Been there, done that! The following is broke up into
three sections. The first one is the basic code to send an e-mail via Lotus
notes. The second section is a brief example of how to use variables to
capture information to be sent out. The third part incorporates that
information into the Lotus Notes code. Be sure to go into the VBE window,
click "Tools", "references", and scroll down and click the "Lotus Notes..."
reference.
Be patient and calm as this will be sort of long:
=======Start of Section One======
Dim Session As Object, DB As Object, Memo As Object
Dim Server$, Mailfile$
Dim Item As Object, strSubject As String, strBody As String
strSubject = "Put your subject here"
Set Session = CreateObject("Notes.NotesSession")
' Read the current mail server from Notes.ini
Server$ = Session.GETENVIRONMENTSTRING("MailServer", True)
' Read the current mail file from Notes.ini
Mailfile$ = Session.GETENVIRONMENTSTRING("MailFile", True)
' Try to open the mail database
Set DB = Session.GETDATABASE(Server$, Mailfile$)
' If Mail db not accessible, return an error
If Not DB.IsOpen Then
MsgBox "Could not access Notes mail file! Please contact blah, blah, blah."
Exit Sub
End If
'LN Message
'Create a memo in the user's mail file
Set Memo = DB.CREATEDOCUMENT
'Set the form to be a mail memo
Memo.Form = "Memo"
Memo.copyto = "wherever"
'Set the "from" field (not necessary)
Memo.From = Session.UserName
'Set the recipient of the memo (you will change this for your presentation -
PLEASE)!
Memo.SendTo = "put your e-mail address here"
'Give the memo a subject
Memo.Subject = strSubject
'Give the memo a body message
Memo.Body = "Put your memo body text here"
'Sends the memo and does not save the message
Call Memo.SEND(False, False)
' Restore NOTES variables back to nothing
Set DB = Nothing
Set Session = Nothing
=======End of Section One======
=======Start of Section Two=====
I usually have some variables declared that hold certain information like
LastName, FirstName, EmployeeID, etc. I might capture this on a UserForm
from a macro on the first slide. You can set these variables to text inside
a textbox on a slide, etc. The trick is to know the name of the object on
the slide (like AutoShape4), or give it a unique name using the below macro:
Sub NameShape()
Dim Name$
On Error GoTo AbortNameShape
If ActiveWindow.Selection.ShapeRange.Count = 0 Then
MsgBox "No Shapes Selected"
Exit Sub
End If
Name$ = ActiveWindow.Selection.ShapeRange(1).Name
Name$ = InputBox$("Give this shape a name", "Shape Name", Name$)
If Name$ <> "" Then
ActiveWindow.Selection.ShapeRange(1).Name = Name$
End If
Exit Sub
AbortNameShape:
MsgBox Err.Description
End Sub
Once you have this information captured, instead of attaching a PowerPoint
file with the information on one slide, put that info into variables and
send those variables in the body of the message. The last section provides
a sample!
=======End of Section Two=====
=======Start of Section Three====
This is the same code as above with a few variables that I captured in the
body of the message. Obviously you would need to have these variable names
changed to capture the info you want. Here goes:
Dim Session As Object, DB As Object, Memo As Object
Dim Server$, Mailfile$
Dim Item As Object, strSubject As String, strBody As String
strSubject = strLessonNumber & ", " & strLessonTitle & " CBT Completed"
Set Session = CreateObject("Notes.NotesSession")
' Read the current mail server from Notes.ini
Server$ = Session.GETENVIRONMENTSTRING("MailServer", True)
' Read the current mail file from Notes.ini
Mailfile$ = Session.GETENVIRONMENTSTRING("MailFile", True)
' Try to open the mail database
Set DB = Session.GETDATABASE(Server$, Mailfile$)
' If Mail db not accessible, return an error
If Not DB.IsOpen Then
MsgBox "Could not access Notes mail file! Please call yours truly to
receive credit."
Exit Sub
End If
'LN Message
'Create a memo in the user's mail file
Set Memo = DB.CREATEDOCUMENT
'Set the form to be a mail memo
Memo.Form = "Memo"
Memo.copyto = "wherever"
'Set the "from" field (not necessary)
Memo.From = Session.UserName
'Set the recipient of the memo (you will change this for your presentation -
PLEASE)!
Memo.SendTo = "put your e-mail address here"
'Give the memo a subject
Memo.Subject = strSubject
'Give the memo a body message
Memo.Body = "I have reviewed the presentation. I scored " & Format(Score,
"00.0%") & _
" on the quiz." & Chr(10) & "First name: " & strfirstname & Chr(10) & _
"Last name: " & strlastname & Chr(10) & "SSN: " & strSSN
'Send the memo
Call Memo.SEND(False, False)
' Restore NOTES variables back to nothing
Set DB = Nothing
Set Session = Nothing
======End of Section Three====
If you want, you can check out my CBT demo at:
http://www.pttinc.com/cbt_development.html
Holler if you have questions!