I managed to send Emails from my Access Db using Lotus notes as Email program including attachments etc. However now I would like to create LN "To do list" entries from my Access Db and send them as well still using Lotus notes. Can any body point me in the right direction? I can't find a VBA code to start with on the internet.
I did do it a view years back for Outlook and that went smooth.
I finally found the time to dig into this again. Unfortunately nobody reacted to my mail but for all of you interested check this out
http://www.fabalou.com/VBandVBA/lotusnotesappointment_ver6.asp
I did change the program as follows.
'Public Sub SendNotesAppointment(Username as string, Subject as string,
'Body as string, AppDate as Date, StartTime as Date, MinsDuration as integer)
'This public sub will write an appointment to a persons diary
'You must have write privleges to the calendar of the user you are going to add an appointment for
'Username is the name of the user's mail database, used to get database
'Also change the servername to reflect the notes server name
Public Sub SendNotesToDoDoc(UserName As String, Subject As String, Body As String, AppDate As Date, StartTime As Date)
'Set up the objects required for Automation into lotus notes
Dim MailDbName As String 'The persons notes mail database name
Dim strSTime As String
Dim strETime As String
Dim ToDoDoc As Object 'The calendar entry itself
Dim WorkSpace As Object
Dim ErrCnt As Integer
Dim SerVer As String
SerVer = "FILL YOUR OWN SERVER NAME"
Set WorkSpace = CreateObject("Notes.NOTESUIWORKSPACE")
'Change this to fit your particular db naming convention based on UserName if necessary
'MailDbName = "mail\" + UserName + ".nsf"
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " ")))
MailDbName = "mail\" & Left$(MailDbName, 8) & ".nsf"
strSTime = CStr(FormatDateTime(StartTime, vbShortTime))
strETime = CStr(FormatDateTime(DateAdd("n", MinsDuration, StartTime), vbShortTime))
'MAKE SURE TO SET SERVER NAME BELOW
Set ToDoDoc = WorkSpace.COMPOSEDOCUMENT(SerVer, MailDbName, "to do")
'ToDoDoc.FIELDSETTEXT "AppointmentType", "0"
'ToDoDoc.Refresh
'Each loop is used to write the value to the field until the field is changed to that value
Do Until (Len(Right(ToDoDoc.FIELDGETTEXT("StartDate"), 10))) <> 0 And ErrCnt < 1000
ToDoDoc.FIELDSETTEXT "StartDate", CStr(FormatDateTime(AppDate, vbShortDate))
ToDoDoc.Refresh
'ErrCnt is used to prevent an endless loop
ErrCnt = ErrCnt + 1
Loop
ErrCnt = 0
ErrCnt = 0
ToDoDoc.FIELDSETTEXT "Subject", Subject
ToDoDoc.FIELDSETTEXT "Body", Body
ToDoDoc.Refresh
ToDoDoc.Save
ToDoDoc.Close
Set ToDoDoc = Nothing
Set WorkSpace = Nothing
End Sub
'***************
Function test()
SendNotesToDoDoc "jan zandberg", "effe testen", "Als dit lukt dan lukt er meer", Date, Date & " " & Time()
End Function
It's not fully working yet since I do not know the field names in the Lotus form yet.
So if any one out there knows the names for the fields please let me know.
I did do it a view years back for Outlook and that went smooth.
I finally found the time to dig into this again. Unfortunately nobody reacted to my mail but for all of you interested check this out
http://www.fabalou.com/VBandVBA/lotusnotesappointment_ver6.asp
I did change the program as follows.
'Public Sub SendNotesAppointment(Username as string, Subject as string,
'Body as string, AppDate as Date, StartTime as Date, MinsDuration as integer)
'This public sub will write an appointment to a persons diary
'You must have write privleges to the calendar of the user you are going to add an appointment for
'Username is the name of the user's mail database, used to get database
'Also change the servername to reflect the notes server name
Public Sub SendNotesToDoDoc(UserName As String, Subject As String, Body As String, AppDate As Date, StartTime As Date)
'Set up the objects required for Automation into lotus notes
Dim MailDbName As String 'The persons notes mail database name
Dim strSTime As String
Dim strETime As String
Dim ToDoDoc As Object 'The calendar entry itself
Dim WorkSpace As Object
Dim ErrCnt As Integer
Dim SerVer As String
SerVer = "FILL YOUR OWN SERVER NAME"
Set WorkSpace = CreateObject("Notes.NOTESUIWORKSPACE")
'Change this to fit your particular db naming convention based on UserName if necessary
'MailDbName = "mail\" + UserName + ".nsf"
MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " ")))
MailDbName = "mail\" & Left$(MailDbName, 8) & ".nsf"
strSTime = CStr(FormatDateTime(StartTime, vbShortTime))
strETime = CStr(FormatDateTime(DateAdd("n", MinsDuration, StartTime), vbShortTime))
'MAKE SURE TO SET SERVER NAME BELOW
Set ToDoDoc = WorkSpace.COMPOSEDOCUMENT(SerVer, MailDbName, "to do")
'ToDoDoc.FIELDSETTEXT "AppointmentType", "0"
'ToDoDoc.Refresh
'Each loop is used to write the value to the field until the field is changed to that value
Do Until (Len(Right(ToDoDoc.FIELDGETTEXT("StartDate"), 10))) <> 0 And ErrCnt < 1000
ToDoDoc.FIELDSETTEXT "StartDate", CStr(FormatDateTime(AppDate, vbShortDate))
ToDoDoc.Refresh
'ErrCnt is used to prevent an endless loop
ErrCnt = ErrCnt + 1
Loop
ErrCnt = 0
ErrCnt = 0
ToDoDoc.FIELDSETTEXT "Subject", Subject
ToDoDoc.FIELDSETTEXT "Body", Body
ToDoDoc.Refresh
ToDoDoc.Save
ToDoDoc.Close
Set ToDoDoc = Nothing
Set WorkSpace = Nothing
End Sub
'***************
Function test()
SendNotesToDoDoc "jan zandberg", "effe testen", "Als dit lukt dan lukt er meer", Date, Date & " " & Time()
End Function
It's not fully working yet since I do not know the field names in the Lotus form yet.
So if any one out there knows the names for the fields please let me know.
Last edited: