Sub ConformationMail2()
On Error GoTo error:
Dim s As Object
Dim db As Object
Dim doc As Object
On Error Resume Next
' Defer error trapping.
' Getobject function called without the first argument returns a
' reference to an instance of the application. If the application isn't
' running, an error occurs.
Set s = GetObject("", "Notes.NotesSession")
If Err.Number <> 0 Then
MsgBox "Notes is Not Running"
Err.Clear ' Clear Err object in case error occurred.
Exit Sub
Else
UserName = s.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set db = s.GETDATABASE("", MailDbName)
Call db.OPENMAIL
mycell = Sheet1.Cells(1, 4)
Set doc = db.CREATEDOCUMENT
Msg = "WSM-Marketing Package has been installed. " & Date & " " & Time & Chr(10)
Call doc.REPLACEITEMVALUE("SendTo", "anton.water@whereever.com")
Call doc.REPLACEITEMVALUE("Subject", "WSM-Marketing User")
Call doc.REPLACEITEMVALUE("Body", Msg)
Call doc.Send(False)
Set s = Nothing
End If
error:
End Sub