Lotus Notes Kalendereintrag aus Access

30/09/2009 - 10:33 von Carsten Ulinski | Report spam
Hallo zusammen,
möchte aus meiner Veranstaltungs-DB Kalendereintràge der Teilnehmer in
Lotus Notes erstellen. Beim suchen bin ich auf diesen Code gestoßen:

Private Function Kalendereintrag(UserName As String, Subject As
String, _
Body As String, AppDate As Date, _
StartTime As Date, MinsDuration As
Integer, _
Location As String, Categories As
String, _
AppointmentType As String, _
ServerName As String)

On Error GoTo ende
'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 CalenDoc As Object 'The calendar entry itself
Dim WorkSpace As Object
Dim ErrCnt As Integer

Set WorkSpace = CreateObject("notes.workspacename")
'Change this to fit your particular db naming convention based on
'UserName if necessary
'MailDbName = "mail\" + UserName + ".nsf"
'Get the engineer username and then calculate the mail file name
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 CalenDoc = WorkSpace.COMPOSEDOCUMENT(ServerName, MailDbName, _
"Appointment")
CalenDoc.FIELDSETTEXT "AppointmentType", AppointmentType = "0"
'0=Appointment, 1=Anniversary, 2=AllDayEvent, 3=Meeting,
4=Reminder
CalenDoc.Refresh
'Each loop is used to write the value to the field until the field
is
'changed to that value
Do Until (CDate(Right(CalenDoc.fieldgettext("StartDate"), 10)) = _
CDate(AppDate)) Or
ErrCnt = 1000
CalenDoc.FIELDSETTEXT "StartDate", _
CStr(FormatDateTime(AppDate,
vbShortDate))
CalenDoc.Refresh
'ErrCnt is used to prevent an endless loop
ErrCnt = ErrCnt + 1
Loop
ErrCnt = 0
Do Until (CDate(CalenDoc.fieldgettext("StartTime")) = _
CDate(strSTime)) Or
ErrCnt = 1000
CalenDoc.FIELDSETTEXT "StartTime", strSTime
CalenDoc.Refresh
ErrCnt = ErrCnt + 1
Loop
ErrCnt = 0
Do Until (CDate(Right(CalenDoc.fieldgettext("EndDate"), 10)) = _
CDate(AppDate)) Or
ErrCnt = 1000
CalenDoc.FIELDSETTEXT "EndDate", _
CStr(FormatDateTime(AppDate,
vbShortDate))
CalenDoc.Refresh
ErrCnt = ErrCnt + 1
Loop
ErrCnt = 0
Do Until (CDate(CalenDoc.fieldgettext("EndTime")) = CDate
(strETime)) Or _
ErrCnt = 1000
CalenDoc.FIELDSETTEXT "EndTime", strETime
CalenDoc.Refresh
ErrCnt = ErrCnt + 1
Loop
'weil ich Body nicht in den Body bekomme
CalenDoc.FIELDSETTEXT "Subject", Subject & " / Betreff: " & Body
CalenDoc.FIELDSETTEXT "Location", Location
'erscheint nur wird aber nicht übernommen
CalenDoc.FIELDSETTEXT "Body", Body
CalenDoc.FIELDSETTEXT "Categories", Categories
CalenDoc.Refresh
' CalenDoc.Save 'dadurch wird der Eintrag sofort gespeichert
' CalenDoc.Close 'dadurch wird der Eintrag sofort gesendet
Set CalenDoc = Nothing
Set WorkSpace = Nothing
MsgBox "Ein neuer Eintrag wurde in Lotus Notes geöffnet, " & _
"bitte überprüfen Sie Ihr Lotus und speichern Sie den
Eintrag"
ende:

End Function

Super Sache dachte ich mir, aber ich werde aus dem Code nicht wirklich
schlau. Ich kann wohl die Startvariablen aus dem
Veranstaltungsformular vorfüllen, aber dann drücke ich auf's Knöpfchen
und es passiert genau nix.

Kann mir jemand den code bisserl erklàren oder evtl. kennt ja jemand
eine andere Lösung?

Vielen Dank im Voraus
Carsten
 

Lesen sie die antworten

#1 Carsten
30/09/2009 - 12:57 | Warnen spam
ERLEDIGT!!!!

On 30 Sep., 10:33, Carsten Ulinski wrote:
Hallo zusammen,
möchte aus meiner Veranstaltungs-DB Kalendereintràge der Teilnehmer in
Lotus Notes erstellen. Beim suchen bin ich auf diesen Code gestoßen:

Private Function Kalendereintrag(UserName As String, Subject As
String, _
                                Body As String, AppDate As Date, _
                                StartTime As Date, MinsDuration As
Integer, _
                                Location As String, Categories As
String, _
                                AppointmentType As String, _
                                ServerName As String)

 On Error GoTo ende
 '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 CalenDoc As Object 'The calendar entry itself
    Dim WorkSpace As Object
    Dim ErrCnt As Integer

    Set WorkSpace = CreateObject("notes.workspacename")
    'Change this to fit your particular db naming convention based on
    'UserName if necessary
    'MailDbName = "mail\" + UserName + ".nsf"
    'Get the engineer username and then calculate the mail file name
    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 CalenDoc = WorkSpace.COMPOSEDOCUMENT(ServerName, MailDbName, _
                                             "Appointment")
    CalenDoc.FIELDSETTEXT "AppointmentType", AppointmentType = "0"
           '0=Appointment, 1=Anniversary, 2=AllDayEvent, 3=Meeting,
4=Reminder
    CalenDoc.Refresh
    'Each loop is used to write the value to the field until the field
is
    'changed to that value
    Do Until (CDate(Right(CalenDoc.fieldgettext("StartDate"), 10)) = _
                                              CDate(AppDate)) Or
ErrCnt = 1000
        CalenDoc.FIELDSETTEXT "StartDate", _
                              CStr(FormatDateTime(AppDate,
vbShortDate))
        CalenDoc.Refresh
        'ErrCnt is used to prevent an endless loop
        ErrCnt = ErrCnt + 1
    Loop
    ErrCnt = 0
    Do Until (CDate(CalenDoc.fieldgettext("StartTime")) = _
                                             CDate(strSTime)) Or
ErrCnt = 1000
        CalenDoc.FIELDSETTEXT "StartTime", strSTime
        CalenDoc.Refresh
        ErrCnt = ErrCnt + 1
    Loop
    ErrCnt = 0
    Do Until (CDate(Right(CalenDoc.fieldgettext("EndDate"), 10)) = _
                                              CDate(AppDate)) Or
ErrCnt = 1000
        CalenDoc.FIELDSETTEXT "EndDate", _
                              CStr(FormatDateTime(AppDate,
vbShortDate))
        CalenDoc.Refresh
        ErrCnt = ErrCnt + 1
    Loop
    ErrCnt = 0
    Do Until (CDate(CalenDoc.fieldgettext("EndTime")) = CDate
(strETime)) Or _
             ErrCnt = 1000
        CalenDoc.FIELDSETTEXT "EndTime", strETime
        CalenDoc.Refresh
        ErrCnt = ErrCnt + 1
    Loop
    'weil ich Body nicht in den Body bekomme
    CalenDoc.FIELDSETTEXT "Subject", Subject & " / Betreff: " & Body
    CalenDoc.FIELDSETTEXT "Location", Location
    'erscheint nur wird aber nicht übernommen
    CalenDoc.FIELDSETTEXT "Body", Body
    CalenDoc.FIELDSETTEXT "Categories", Categories
     CalenDoc.Refresh
  '  CalenDoc.Save 'dadurch wird der Eintrag sofort gespeichert
  '  CalenDoc.Close 'dadurch wird der Eintrag sofort gesendet
    Set CalenDoc = Nothing
    Set WorkSpace = Nothing
    MsgBox "Ein neuer Eintrag wurde in Lotus Notes geöffnet, " & _
           "bitte überprüfen Sie Ihr Lotus und speichern Sie den
Eintrag"
ende:

End Function

Super Sache dachte ich mir, aber ich werde aus dem Code nicht wirklich
schlau. Ich kann wohl die Startvariablen aus dem
Veranstaltungsformular vorfüllen, aber dann drücke ich auf's Knöpfchen
und es passiert genau nix.

Kann mir jemand den code bisserl erklàren oder evtl. kennt ja jemand
eine andere Lösung?

Vielen Dank im Voraus
Carsten

Ähnliche fragen