By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,738 Members | 1,456 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,738 IT Pros & Developers. It's quick & easy.

Late binding example

P: n/a
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.OlDefaultFolder s.olFolderContacts)
ICount = F.Items.Count
For I = 1 To ICount
oContact = DirectCast(F.Items.Item(I), Outlook.ContactItem)
If InStr(oContact.Categories, "X") <> Then
oContact.Delete()
End If
Next I
iCon = CType(F.Items().Add(Outlook.OlItemType.olContactIt em),
Outlook.ContactItem)
F.Items().Add(Outlook.OlItemType.olContactItem)
With iCon
..CompanyName = "My Company"
..Categories = "Clients"
..Save()
End With
End Sub
End Module
Feb 23 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.