|
-
Nov 20th, 2000, 02:22 PM
#1
Thread Starter
New Member
How can I get a list of all email stored in the outlook address book? I'm going to use this in an axtivex 'tell a friend' control.
/Niels Bosma
-
Nov 20th, 2000, 02:38 PM
#2
_______
<?>
Code:
Option Explicit
Private Sub Form_Load()
'set a reference to outlook in references
Dim moMail As Object
Dim loNameSpace As Object
Dim loNameAddresses As Object
Dim loAddresses As Object
Dim loAddressList As Object
Set moMail = New Outlook.Application
Dim moAddresses As Outlook.AddressLists
Set loNameSpace = moMail.GetNamespace("MAPI")
Set loAddresses = loNameSpace.AddressLists("Contacts")
Set loAddressList = loAddresses.AddressEntries
List1.Clear
Dim intcre As Integer
For intcre = 1 To loAddressList.Count
List1.AddItem loAddressList.Item(intcre).Name
List1.AddItem loAddressList.Item(intcre).Address
List1.AddItem "________________________________"
List1.AddItem ""
Next intcre
End Sub
Private Sub List1_Click()
Dim SendMe As String
SendMe = List1.Text
ShellExecute hwnd, "open", "mailto:" & SendMe, vbNullString, vbNullString, SW_SHOW
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 20th, 2000, 04:10 PM
#3
Thread Starter
New Member
Reference?
thanks for the code!, but...
I can't find Outlook in my reference list. I have outlook express on my computer and the program has to work with both versions !?! Do I have to intall the full office version on outlook?
/Niels
-
Nov 20th, 2000, 04:28 PM
#4
_______
<?>
I don't know for sure but I would think this will only work for Outlook/full version.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Nov 21st, 2000, 01:58 PM
#5
Thread Starter
New Member
Errros....
I get runtime error on this line:
Set loAddresses = loNameSpace.AddressLists("Contacts")
('Object could not be found')
/Niels
-
Nov 21st, 2000, 02:03 PM
#6
_______
<?>
Are you trying this on a network. If you are, it more than likely won't work because any good network will have their address list on a drive that is not accessable to anyone without superviory or administrative authority.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|