'==========================================================================
'
' NAME: CreateContactFromExcel.vbs
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL: [URL unfurl="true"]http://www.thespidersparlor.com[/URL]
' DATE : 5/25/2005
'
' COMMENT: Creates contacts from an Excel Spreadsheet.
' Create speadsheet with the following headings
'
' Column A Company
' Column B Email
' Column C Phone
' Column D Fax
' Column E Street
' Column F Street2
' Column G City
' Column H State
' Column I Zip
'==========================================================================
set x = getobject(,"excel.application")
r = 2
do until len(x.cells(r, 1).value) = 0
company = x.cells(r, 1).value
email = x.cells(r, 2).value
phone = x.cells(r, 3).value
fax = x.cells(r, 4).value
street = x.cells(r, 5).value
suite = x.cells(r, 6).value
city = x.cells(r, 7).value
state = x.cells(r, 8).value
zip =cstr(x.cells(r, 9).value)
if len(email) = 0 then
email = " "
end if
if len(phone) = 0 then
phone = " "
end if
if len(extension) = 0 then
extension = " "
end if
if len(fax) = 0 then
extension = " "
end if
if len(street) = 0 then
street = " "
end if
if len(suite) = 0 then
suite = " "
end if
if len(city) = 0 then
city = " "
end if
if len(state) = 0 then
state = " "
end if
if len(zip) = 0 then
zip = " "
end if
Set ContactLocation = GetObject("LDAP://OU=FaxList,CN=Users,DC=CompanyName,DC=com")
Set objUser = ContactLocation.Create("Contact", "cn="&contactemail)
objUser.Put "Description", company
objUser.Put "Mail", & email
objUser.Put "mailNickname", & email
objUser.Put "proxyAddresses", "SMTP:" & email
objUser.Put "mAPIRecipient", "FALSE"
objUser.Put "targetAddress", "SMTP:" & email
objUser.Put "msExchALObjectVersion", "25"
objUser.Put "msExchHideFromAddressLists", "FALSE"
objUser.Put "company", company
objUser.Put "facsimileTelephoneNumber", fax
objUser.Put "l", city
objUser.Put "postalCode", zip
objUser.Put "st", state
objUser.Put "streetAddress", street & vbCrLf & Suite
objUser.Put "telephoneNumber", phone & "Ext. "& extension
objUser.SetInfo
r = r+1
Loop