J
John
Hi
I have the below code for communicating with outlook. What changes do I need
to do to late bind this code so it does not need references to any
particular version of outlook.
Many Thanks
Regards
Imports System.Reflection
Imports Outlook
Module modContacts
Dim O As Outlook.Application
Dim F As Outlook.MAPIFolder
Dim iCon As Outlook.ContactItem
Sub Contacs2Outlook()
O = New Outlook.Application
F =
O.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)
oContact = DirectCast(F.Items.Item(1), Outlook.ContactItem)
oContact.Delete()
iCon = CType(F.Items().Add(Outlook.OlItemType.olContactItem),
Outlook.ContactItem)
F.Items().Add(Outlook.OlItemType.olContactItem)
With iCon
.CompanyName = "My Computer"
.Categories = "Clients"
.Save()
End With
End Sub
End Module
I have the below code for communicating with outlook. What changes do I need
to do to late bind this code so it does not need references to any
particular version of outlook.
Many Thanks
Regards
Imports System.Reflection
Imports Outlook
Module modContacts
Dim O As Outlook.Application
Dim F As Outlook.MAPIFolder
Dim iCon As Outlook.ContactItem
Sub Contacs2Outlook()
O = New Outlook.Application
F =
O.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)
oContact = DirectCast(F.Items.Item(1), Outlook.ContactItem)
oContact.Delete()
iCon = CType(F.Items().Add(Outlook.OlItemType.olContactItem),
Outlook.ContactItem)
F.Items().Add(Outlook.OlItemType.olContactItem)
With iCon
.CompanyName = "My Computer"
.Categories = "Clients"
.Save()
End With
End Sub
End Module