I have saved the code below as a module . How doe I call up this function
from the form?
Function CreateMail(astrRecip As Variant, _
strSubject As String, _
strMessage As String, _
Optional astrAttachments As Variant) As Boolean
Dim olApp As Outlook.Application
Dim objNewMail As Outlook.MailItem
Dim varRecip As Variant
Dim varAttach As Variant
Dim blnResolveSuccess As Boolean
On Error GoTo CreateMail_Err
Set olApp = New Outlook.Application
Set objNewMail = olApp.CreateItem(olMailItem)
With objNewMail
' Add each item in the varRecip array to the Recipients collection.
For Each varRecip In astrRecip
.Recipients.Add varRecip
Next varRecip
' Determine if all recipients have corresponding entries in the
' Outlook address book.
blnResolveSuccess = .Recipients.ResolveAll
' Add each item in the varAttach array to the Attachments collection
' and specify the subject and text of the mail message.
For Each varAttach In astrAttachments
.Attachments.Add varAttach
Next varAttach
.Subject = strSubject
.Body = strMessage
' If all recipients are valid then send the message now, otherwise
' display the message so the user can fix invalid e-mail addresses.
If blnResolveSuccess Then
.Send
Else
MsgBox "Unable to resolve all recipients. Please check " _
& "the names."
.Display
End If
End With
CreateMail = True
CreateMail_End:
Exit Function
CreateMail_Err:
CreateMail = False
Resume CreateMail_End
End Function
Regards Billy