DOCUMENT:Q161152 15-SEP-1997 [vbwin] TITLE :HOWTO: Add a New Appointment in Schedule Plus PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:5.0 OPER/SYS:WINDOWS KEYWORDS:vb5all vb5howto VBKBProgramming GnrlVb kbprg ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Professional and Enterprise Editions, for Windows, version 5.0 --------------------------------------------------------------------- SUMMARY ======= This article demonstrates how to use Visual Basic code to add an appointment to Schedule Plus. MORE INFORMATION ================ 1. Start a new Standard EXE project. Form1 is added by default. 2. Add a CommandButton to Form1. 3. Place the following code in the General Declarations section of Form1: Option Explicit Private Sub Command1_Click() Dim objSchdPlus As Object Dim objContact As Object Dim dStartTime As Date Dim iNumHours As Integer Set objSchdPlus = CreateObject("SchedulePlus.application") objSchdPlus.Logon Set objContact = _ objSchdPlus.ScheduleSelected.SingleAppointments.New dStartTime = "01/04/96 12:15:00" iNumHours = 1 objContact.SetProperties Text:="Santa Claus", _ Start:=dStartTime, End:=DateAdd("h", _ iNumHours, dStartTime), Notes:="Booking xmas presents" objSchdPlus.Logoff End Sub 4. Press the F5 key to run the project, and click the CommandButton. Note that when you look at the Schedule Plus database, you see the new appointment. NOTE: If Schedule Plus 7.0 is not running, the above code will result in run-time error 450: Wrong number of arguments or invalid property assignment. ====================================================================== Keywords : vb5all vb5howto VBKBProgramming GnrlVb kbprg Version : WINDOWS:5.0 Platform : WINDOWS Issue type : kbhowto ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1997.