Hi,
I am new to Notes, and I was wondering if there is any easy LotusScript code for closing dialog boxes. I know it can be done in Formula with @Command[CloseWindow], but I need to be able to do it in LotusScript.
Here is the code if it helps at all.
Sub Click(Source As Button)
Const sStartDateTime = "03/07/2009 16:30:00"
Const sLocation = "My Workspace"
Const sSubject = "Green Team Reminder"
Const sSendTo = "Daffy Duck/"
Const sMessage = "A reminder to shut the blinds, turn off your monitor, and be green for the weekend."
Dim Session As NotesSession
Dim Workspace As NotesUIWorkspace
Dim dbMail As NotesDatabase
Dim docMail As NotesDocument
Dim vMailAddress As Variant
Dim dtStart As NotesDateTime, dtEnd As NotesDateTime, dtNow As NotesDateTime
Dim drAppointment As NotesDateRange
Dim uiAppointment As NotesUIDocument
Dim vFreeTime As Variant
Dim bContinue As Boolean
Set Session = New NotesSession
Set dtNow = New NotesDateTime("")
dtNow.SetNow
Set dtStart = New NotesDateTime(sStartDateTime)
bContinue = True
If bContinue Then
Set Workspace = New NotesUIWorkspace
Set dbMail = New NotesDatabase("", "")
vMailAddress = Evaluate("@MailDBName")
Dim doc As NotesDocument
If dbMail.OpenWithFailover(vMailAddress(0), vMailAddress(1)) Then
Set uiAppointment = Workspace.ComposeDocument(vMailAddress(0), vMailAddress(1), "Appointment")
With uiAppointment
' note that this might be Notes 8 specific
' Notes 6 might need to retain AppointmentType field setting
.FieldSetText "tmpAppointmentType", "4"
' Notes 6 original setting
' .FieldSetText "AppointmentType", "4"
.FieldSetText "Subject", sSubject
.FieldSetText "Location", sLocation
.FieldSetText "StartDate", dtStart.DateOnly
.FieldSetText "StartTime", dtStart.TimeOnly
.GotoField "Body"
.FieldSetText "Body", sMessage + Chr$(10)
End With
Set doc = uiAppointment.Document
' ---> changes made here
' these fields must be set for the appointment to display in the correct place
doc.ReplaceItemValue "CalendarDateTime", dtStart
doc.ReplaceItemValue "StartDateTime", dtStart
doc.ReplaceItemValue "Repeats", "1"
Set dtEnd = dtStart
Call dtEnd.AdjustYear(10)
doc.ReplaceItemValue "RepeatInterval", "7"
doc.ReplaceItemValue "RepeatHow", "U"
doc.ReplaceItemValue "RepeatUntil", dtEnd
doc.ReplaceItemValue "$Alarm", 1
uiAppointment.Refresh
uiAppointment.Save
uiAppointment.Close
Set uiAppointment = Nothing
Set docMail = New NotesDocument(dbMail)
With docMail
.ReplaceItemValue "Form", "Memo"
.ReplaceItemValue "Subject", Session.CommonUserName + " has pressed the """ + sSubject + """ buton "
.ReplaceItemValue "SendTo", sSendTo
.Send False
End With
Delete docMail
Else
Messagebox "Unable to locate mail database", 48
End If
Set dbMail = Nothing
Erase vMailAddress
Set Workspace = Nothing
End If
Delete dtStart
Set Session = Nothing
End Sub
Basically, I am trying to code a button which will enter a repeating entry into people’s calendars. The trouble is, the code opens the Repeating Entry and Alarm dialog boxes, and I don’t want users to have to keeping clicking “Ok”.
Thanks.