Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Dim notesdb As Object ' notes Database
Dim notesdoc As Object ' notes email document
Dim notesrtf As Object ' notes email body
Dim notessession As Object ' notes session
Dim names As Variant ' will become an array to hold all
' recipient addresses
Dim subj As String ' the email subject
Dim body_text As String ' the email body text
Dim file_path As String ' the attachment DOS path
ReDim names(name_count) ' name_count is a count of all
' recipients.this code doesn't show
' how to perform this count
' as there are so many ways to
' collect the names such as the
' selected items in a combo-box,
' a recordset from a query, a
' collection of text boxes etc.
' it should be easy to adapt
' your code to suit.
' at this point you need to convert your list of recipients into an array.
' how to do this is beyond the scope of this code as the source of names is
' so variable (as mentioned above).
' In structured English your code should look something like this:
' For Each email address In recipient list
' add email address to array
' Next
' however you do it, add the email addresses to the "names" array
subj = "This email is for you!" ' get subject
body_text = "This text goes into the body of the email" ' get body text
file_path = "C:\filename.txt" ' get attachment path
Set notessession = CreateObject("Notes.Notessession") ' start notes
Set notesdb = notessession.GetDatabase("", "") ' set notesdb to
' database not yet named
Call notesdb.OPENMAIL ' assigns notesdb to
' current user's mail
' database and opens it
Set notesdoc = notesdb.CreateDocument ' create new email
Call notesdoc.replaceitemvalue("Sendto", names) ' set receipt address
Call notesdoc.replaceitemvalue("Subject", subj) ' set subject
Set notesrtf = notesdoc.CreateRichTextItem("body") ' create body section
Call notesrtf.AddNewLine(1) ' insert 1 carriage
' return
Call notesrtf.AppendText(body_text) ' append body text
Call notesrtf.AddNewLine(4) ' insert 4 carriage
' returns
Call notesrtf.EmbedObject(1454, "", file_path) ' attach file
notesrtf.SaveMessageOnSend = True ' save message in Sent
' folder
Call notesdoc.Send(False) ' send email
Set notessession = Nothing