Request for suggestions on contacts program.

  • Thread starter Thread starter Amanda & Clay Crook
  • Start date Start date
A

Amanda & Clay Crook

I am looking for suggestions on how to keep track of the last time I called
a contact within Outlook.

Background
My company uses Windows 2000, and I work in Outlook 2000 SR-1.

I have written a routine which will go into my contacts folder and select a
contact at random. The attached code is that routine, and it works just
fine. The code is modified from one in "Outlook 2000 VBA Programmer's
Reference", by Dwayne Gifford. However I would like too call someone again
after a certain period of time, and so I would like to keep track of the
last time I called them. The goal would be to select a contact at random
that I haven't talked to in the last 60 or 90 days.

The first tactic I tried for keeping up with the date was to put the date in
the anniversary property. The problem was that the anniversary was then set
as a recurring appointment on my calendar, which I don't want.

I thought before I proceeded further you all might have some suggestions.

Thanks in advance for your ideas, and comments.
Clay.





Sub CallPhoneList()
Dim ofContacts As MAPIFolder
Dim oicItems As Items
Dim ocContact As ContactItem
Dim ContactsCount As Integer
Dim RandomContact As Integer


Set ofContacts = _
Application.GetNamespace("MAPI").GetDefaultFolder(olFolderContacts)

Set oicItems = ofContacts.Items
'Now, let's count the number of items
ContactsCount = oicItems.Count
'MsgBox (ContactsCount)

'Now we need to pick a random number between 1 and contactscount
50  RandomContact = Int((ContactsCount - 1 + 1) * Rnd + (1))
'MsgBox (RandomContact)
Set ocContact = oicItems.Item(RandomContact)

'Now make sure that the one selected has the category "Phonelist"
If ocContact.Categories Like "*Phonelist*" Then
ocContact.Display (True)
Else
'if it doesn't, re-seed the random number generator
'I put this statement in because if you don't, it will reselect the same
'contacts
Randomize
'Go back to square 1
GoTo 50
End If

End Sub
 
Why not just add a UserProperty to the contact that has the date/time you
called? You can then use that for comparison. Any contact not yet called,
where the UserProperty wouldn't be initialized, would have a value of None
(#1/1/4501#).
 
Back
Top