D
Dave
Trying to add a new contact with the following code. If Outlook is already
open then this code works well. If Outlook is not open then this code fails
"Method 'Save' of object '_ContactItem' failed". Error # -2147417851
Dim olApp As Outlook.Application
Set olApp = New Outlook.Application
Dim olItem As Outlook.ContactItem
Set olItem = olApp.CreateItem(olContactItem)
With olItem
.FullName = "John Doe"
.Birthday = "6/30/1980"
.HomeTelephoneNumber = "800-555-1212"
.Email1Address = "(e-mail address removed)"
End With
'this is what fails
olItem.Save
Dave
open then this code works well. If Outlook is not open then this code fails
"Method 'Save' of object '_ContactItem' failed". Error # -2147417851
Dim olApp As Outlook.Application
Set olApp = New Outlook.Application
Dim olItem As Outlook.ContactItem
Set olItem = olApp.CreateItem(olContactItem)
With olItem
.FullName = "John Doe"
.Birthday = "6/30/1980"
.HomeTelephoneNumber = "800-555-1212"
.Email1Address = "(e-mail address removed)"
End With
'this is what fails
olItem.Save
Dave