Creating appointments via LS

I am creating appointments for some users. The info is in a spreadsheet. I am a member of a group that has manager access. The problem is, some users, the appointments are created fine, others the docs are created as meetings with the current date time. Any ideas or suggestions are greatly appreciated.

Here is my code if interested:

Dim s As NotesSession

Dim ws As New NotesUIWorkspace

Dim db As NotesDatabase

Dim uidoc As NotesUIDocument

Dim mailDoc As NotesDocument

Dim XLApp As Variant

Dim XLBook As Variant

Dim XLSheet As Variant

Dim oldRepName As String

Dim sMailPath As String



Rep(0)= "Dunston"

Rep(1)= "ixx"

Rep(2)= "erow"

Rep(3)= "liszewski"

Rep(4)= "lover"

Rep(5)= "aude"

Rep(6)= "ordham"

Rep(7)= "edovian"

Rep(8)= "olmes"

Rep(9)= "eoples"

Rep(10)= "chindler"

Rep(11)= "ordham"

Rep(12)= "ines"

Rep(13)= "kinner"

Rep(14)= "uddephatt"

Rep(15)= "arrington"

Rep(16)= "yjadka"

Rep(17)= "unn"

Rep(18)= "oreil"

Rep(19)= "oore"



On Error Goto KillExcel

Set s = New NotesSession

Set db = s.CurrentDatabase



Print "Executing Query..."

Set XLApp = CreateObject("Excel.Application")

Set xlBook = xlApp.WorkBooks.Open("path to file.xls")

Set xlSheet = xlBook.Sheets(1)

'XLApp.Visible = True		'False

issRow = 2      ' start at row 2 since there are headers

sRepName= ""

'Do Until xlSheet.Cells(issRow, 1).Value = ""

Do Until (issRow= 20) Or (xlSheet.Cells(issRow, 1).Value = "")

	col1= Trim(xlSheet.Cells(issRow, 1).Value)

	col2= Trim(xlSheet.Cells(issRow, 2).Value)

	col3= Trim(xlSheet.Cells(issRow, 3).Value)

	col4= Trim(xlSheet.Cells(issRow, 4).Value)

	col5= Trim(xlSheet.Cells(issRow, 5).Value)

	col6= Trim(xlSheet.Cells(issRow, 6).Value)		

	col7= Trim(xlSheet.Cells(issRow, 7).Value)	

	

	Call ConvertRepInitials	

	If sRepName <> OldRepName Then

		Dim repMailDB As New NotesDatabase("", "")

		sMailPath= "mail\" & sRepMail & ".nsf"

		Call repMailDB.Open( "JDF Notes Server/JDF Associates", sMailPath )

		oldRepName= sRepName

	End If

	Set uidoc= ws.ComposeDocument("JDF Notes Server", sMailPath, "Appointment" )

	Set mailDoc= uidoc.Document

	mailDoc.AppointmentType= "0"

	Set dt= s.CreateDateTime( col2 )

	mailDoc.StartDate= dt.DateOnly

	uidoc.FieldSetText "StartDate", dt.DateOnly

	Set dt= s.CreateDateTime( col3 )

	mailDoc.EndDate= dt.DateOnly

	uidoc.FieldSetText "EndDate", dt.DateOnly

	Set dt= s.CreateDateTime( col4 )

	mailDoc.StartTime= dt.TimeOnly

	uidoc.FieldSetText "StartTime", dt.TimeOnly

	Set dt= s.CreateDateTime( col5 )

	mailDoc.EndTime= dt.TimeOnly

	uidoc.FieldSetText "EndTime", dt.TimeOnly

	'mailDoc.Subject= col6

	uidoc.FieldSetText "Subject", col6

	mailDoc.Body= col7

	Call mailDoc.Save(True, False)

	Call uidoc.Save

	Call uidoc.Close

	Call uidoc.Close

	

	

	'Set repMailDB= Nothing

	issRow = issRow + 1           ' sets the row to the next line

Loop

KillExcel:

XLApp.Visible = True		'False

XLApp.Quit             ' Kill Excel

Subject: Creating appointments via LS

I haven’t tested this out but I would guess your problem is related to the user’s preferences for default calendar entry type. Also, your code has a mix of back-end and ui field references which could be causing problems.

I would suggest creating your document in the background, set your fields (including AppointmentType and Form), THEN open it in the UI using ws.EditDocument and immediately save and close the UI document.

Subject: RE: Creating appointments via LS

Michelle if you were here I’d give you a hug! The default Calendar entry type was the problem. You don’t know how happy I am right now! THANK YOU!!!

Subject: Creating appointments via LS

hi… Could not work on your code as the sub ConvertRepInitials is needed…