I'm sure we all type this stuff TWICE. Enter details into excel and a month later when the job goes ahead, same data goes into Outlook Contacts.
I have the typical A1 "name", A2 "address", A3 "phone" list in excel and I would like to run some VB and put it into an Outlook contact.
I can find lots of code but nothing for outlook 2007 & Excel 2007
This is what I hove fount and is similar to what I am wanting but 2007 seems to be different with its reference to Outlook.
Sub Create_Outlook_Contact() ' Macro by Eliott Robson
Dim outlookApp As Outlook.Application
Dim outlookNameSpace As Outlook.Namespace
Dim outlookFolder As Outlook.Folders
Dim outookContact As Outlook.ContactItem
Dim ContactName As String
Dim ContactAddress As String
Dim ContactHomePhoneNumber As String
Dim ContactEmail As String
Set outlookApp = New Outlook.Application
Set outlookNameSpace = outlookApp.GetNamespace("MAPI")
Set outookContact = outlookApp.CreateItem(olContactItem)
ContactName = Cells(1, "B").Value
ContactAddress = Cells(2, "B").Value
ContactHomePhoneNumber = Cells(3, "B").Value
ContactEmail = Cells(4, "B").Value
With outookContact
.FullName = ContactName
.HomeAddress = ContactAddress
.HomeTelephoneNumber = ContactHomePhoneNumber
.Email1Address = ContactEmail
.JobTitle = ContactEmail
End With
outookContact.Save
MsgBox "Contact exported."
Many thanks.
I have the typical A1 "name", A2 "address", A3 "phone" list in excel and I would like to run some VB and put it into an Outlook contact.
I can find lots of code but nothing for outlook 2007 & Excel 2007
This is what I hove fount and is similar to what I am wanting but 2007 seems to be different with its reference to Outlook.
Sub Create_Outlook_Contact() ' Macro by Eliott Robson
Dim outlookApp As Outlook.Application
Dim outlookNameSpace As Outlook.Namespace
Dim outlookFolder As Outlook.Folders
Dim outookContact As Outlook.ContactItem
Dim ContactName As String
Dim ContactAddress As String
Dim ContactHomePhoneNumber As String
Dim ContactEmail As String
Set outlookApp = New Outlook.Application
Set outlookNameSpace = outlookApp.GetNamespace("MAPI")
Set outookContact = outlookApp.CreateItem(olContactItem)
ContactName = Cells(1, "B").Value
ContactAddress = Cells(2, "B").Value
ContactHomePhoneNumber = Cells(3, "B").Value
ContactEmail = Cells(4, "B").Value
With outookContact
.FullName = ContactName
.HomeAddress = ContactAddress
.HomeTelephoneNumber = ContactHomePhoneNumber
.Email1Address = ContactEmail
.JobTitle = ContactEmail
End With
outookContact.Save
MsgBox "Contact exported."
Many thanks.