Hello I need help in how to add multiple contacts to outlook (contacts are in an access table tblContact)
I have code for enetering one, but can not seem to get it to work with record set and loop. Could someone help create a function to add all records from tblContacts. Thank you
Sub AddAContact()
Dim myOutlook As Outlook.Application
Dim myItems As ContactItem
Set myOutlook = CreateObject("Outlook.Application")
Set myItems = myOutlook.CreateItem(olContactItem)
With myItems
.FirstName = "John"
.LastName = "Smith"
.Email1Address = "j@yourserver.com"
.Save
End With
End Sub
I have code for enetering one, but can not seem to get it to work with record set and loop. Could someone help create a function to add all records from tblContacts. Thank you
Sub AddAContact()
Dim myOutlook As Outlook.Application
Dim myItems As ContactItem
Set myOutlook = CreateObject("Outlook.Application")
Set myItems = myOutlook.CreateItem(olContactItem)
With myItems
.FirstName = "John"
.LastName = "Smith"
.Email1Address = "j@yourserver.com"
.Save
End With
End Sub