Microsoft KB Archive/140542

= Visual Basic Example Logging on to Schedule+ =

Article ID: 140542

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Excel 95 Standard Edition
 * Microsoft Schedule+ 97 Standard Edition, when used with:
 * Microsoft Windows 95

-



This article was previously published under Q140542



SUMMARY
In Microsoft Excel, you can programmatically control Microsoft Schedule+, through Visual Basic for applications using OLE Automation. To use the properties and methods in the object library provided by Schedule+, you will need to create an object variable using the CreateObject function.



MORE INFORMATION
The following example will log you on to Schedule+, display the path to the schedule file, and then log you off.

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.

To use the macro, do the following:

 Open a new workbook, insert a module sheet.  In the new module sheet, type the following macro code: ' In this example you will have to activate Microsoft Excel ' before issuing any commands that require user interaction. Sub Logging_On_To_SchedulePlus

Dim objSched As Object Dim CurApp As String Dim UserName as String

'sets the caption of the active application to a variable 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 onto schedule+ End If

AppActivate CurApp 'activates excel MsgBox objSched.UserAddress ' Displays the path to the user's schedule ' file

objSched.Logoff 'logs off of schedule+ Set objSched = Nothing ' clears the object

End Sub  Run the macro.

