Visual Basic Macro to Insert Data in Schedule+ (138284)



The information in this article applies to:

  • Microsoft Excel for Windows 95
  • Microsoft Schedule+ for Windows 7.0, when used with:
    • the operating system: Microsoft Windows 95

This article was previously published under Q138284

SUMMARY

Microsoft Schedule+ for Windows 95, version 7.0, can be programmatically controlled through Visual Basic for applications. The following example takes data from a Microsoft Excel worksheet and places it in the Contacts database in Microsoft Schedule+.

MORE INFORMATION

Microsoft provides examples of Visual Basic for applications procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. This Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose.

Sample Macro

   Sub Place_Data_From_XL_Into_Contacts()
   Dim objSched, objTable, objItem As Object

   ' Sets a variable to the caption of Excel
   CurApp = Application.Caption

   ' Creates the schedule+ object
   Set objSched = CreateObject("scheduleplus.application.7")

   ' Checks to see if you are logged on to Schedule+
   If Not objSched.LoggedOn Then

      AppActivate CurApp 'activates Excel

      ' Prompts you for you email name
      UserName = Application.InputBox("Please Enter Your Email Name")

      objSched.Logon UserName, "", True   'logs you into schedule+
   End If

   ' Creates the contacts database object
   Set objTable = objSched.ScheduleSelected.Contacts
      With Worksheets("Sheet1")

      ' Starts a loop from 1 to the number of rows of data
         For i = 2 To .Range(.Range("a2"), _
         .Range("a2").End(xlDown)).Rows.Count

            Set objItem = objTable.New ' Creates a blank new entry in the
                                       ' table

            ' Creates new entries in the contacts database
            ' using the values in the appropriate cells
            'The following three lines need to be on one line

            objItem.SetProperties FirstName:=.Range("a" & i).Value, _
                LastName:=.Range("b" & i).Value, _
                PhoneBusiness:=.Range("c" & i).Value, _
                PhoneHome:=.Range("d" & i).Value

         Next i 'returns to the top of the loop

      End With

   End Sub
				

To test the sample macro

  1. Enter the following data on Sheet1 of a new workbook:
       A1: First Name  B1: Last Name  C1: Business Phone  D1: Home Phone
       A2: John        B2: Doe        C2: (232)653-6545   D2: (232)345-4343
       A3: Larry       B3: Popper     C3: (434)564-5465   D3: (434)534-8967
       A4: Peter       B4: Los        C4: (212)896-3465   D4: (867)756-3654
       A5: Neal        B5: West       C5: (545)927-7261   D5: (999)888-1234
       A6: Kevin       B6: Slack      C6: (111)555-6306   D6: (555)596-0000
  2. Run the Place_Data_From_XL_Into_Contacts macro.
  3. To view the new data, switch to Schedule+ and click the Contacts tab.

REFERENCES

For more information about OLE Automation, click the Index tab in Microsoft Help, type the following text

OLE Automation

click the OLE Automation topic, and click the OLE Automation topic in the list of topics found to go to the "OLE Automation" topic.

For more information about programming with Microsoft Schedule+ for Windows 95, version 7.0, you need to have the Microsoft BackOffice Software Development Kit (SDK) installed. In Microsoft BackOffice SDK in the Entire Contents pane, choose Microsoft Exchange Server. There will be a sub-level entitled Microsoft Schedule+ Programmer's Guide.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbProgramming KB138284