We have a program that collects all the new e-mail addresses an
employee receives and sends to that aren't in his Outlook Contacts.
The user's assistant opens a VB application from her desk, reviews the
e-mails, and adds them to the Contacts using the program.
The code opens a new contact form an inserts the e-mail address. It
is left open and not saved, so the user can enter any other info.
So I have code that works without a problem... once I remove the
"myRecipient.Resolve" line of code. When this is in there, I get the
pop-up message that wants me to allow access to Outlook.
Do I need that line of code and if so, how can I get past it?
I have Outlook Redemption, but for the life of me I can't figure out
how to re-code it to use Redemption.
My code:
Dim MyOutlook As outlook.Application
Dim myNameSpace As NameSpace
Dim myFolder As MAPIFolder
Dim myContactItem As outlook.ContactItem
Dim myRecipient As outlook.Recipient
Dim rsNewContacts As DAO.Recordset
Set MyOutlook = CreateObject("Outlook.Application." &
Val(Left(outlook.Version, 2)))
Set myNameSpace = MyOutlook.GetNamespace("MAPI")
Set myRecipient = myNameSpace.CreateRecipient("Don Beaty")
'myRecipient.resolve
Set myFolder = myNameSpace.GetSharedDefaultFolder(myRecipient,
olFolderContacts)
Set myContactItem = myFolder.Items.Add
myContactItem.Email1Address = Me.grdNewContacts.Columns("Email")
myContactItem.Display
Set myContactItem = Nothing
Set myFolder = Nothing
Set myNameSpace = Nothing
Set MyOutlook = Nothing
Archived from group: microsoft>public>office>developer>outlook>vba