Microsoft KB Archive/154575

= How To Extract Appointment Information from Schedule Plus =

Article ID: 154575

Article Last Modified on 7/1/2004

-

APPLIES TO


 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 16-bit Enterprise Edition
 * Microsoft Visual Basic 4.0 32-Bit Enterprise Edition

-



This article was previously published under Q154575



SUMMARY
The OLE Scheduling Library exposes an object model for Microsoft Schedule Plus 7.0 that can be manipulated by the VBA language. This object model allows programmers to gain access to appointment information. This article provides a code sample of how to extract appointment information between two given dates from Schedule Plus.



MORE INFORMATION
 Start Visual Basic. If Visual Basic is already running, choose New Project from the File menu. Form1 is created by default. Place a Command button on Form1.  Add the following code to the General Declarations section of Form1: Option Explicit

Private Sub Command1_Click GetAppointments "06/03/96", "08/03/96" End Sub

Sub GetAppointments(sStartdate As String, sEndDate As String) Dim objSchdPlus As Object Dim gobjappt As Object Dim objappt As Object Dim objitem As Object Dim obatt As Object Screen.MousePointer = vbHourglass Set objSchdPlus = CreateObject("SchedulePlus.Application") objSchdPlus.Logon Set gobjappt = objSchdPlus.ScheduleSelected Print objSchdPlus.UserName Set objappt = gobjappt.singleappointments Set objitem = objappt.Item Print objappt.Rows While Not objappt.IsEndOfTable Set objitem = objappt.Item If CDate(objitem.start) >= CDate(Format$(sStartdate, "dd/mm/yy") & _        " 00:00:00") And CDate(objitem.end) <= CDate(Format$(sEndDate, _ "dd/mm/yy") & " 23:59:59") Then Print "Starts " & objitem.start & "---" & "Ends " & objitem.end Print "Appointment := " & objitem.Text End If      objappt.Skip Wend Screen.MousePointer = vbArrow MsgBox "Done" End Sub  Press the F5 key to run the project. When you click on the button, the appointments that fall into the date range specified will be printed onto the form.

