Article ID: 138284
Article Last Modified on 10/11/2006
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
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
OLE Automation
Additional query words: howto XL7
Keywords: kbprogramming KB138284