B
Bernard.Luksich
This must be a simple problem but we just can't see it.
We have a Visual Basic for Applications program that is looking up
names in an address book in order to find the email address. The
program works great but is a bit slow since it is doing a simple look
up on the address entries. For each address starting at the top.
So we thought, hey, there is a "sort" method for the "addressentries"
object, let's call that and now have the list in order and the lookup
becomes much quicker...we don't have to sca the whole thing if the
entry is not there.
However, when attempting the sort method we keep getting the message...
Run-time error '-1834750 (ffee40102)'
IMAPITable::SortTable was called, which this object does not support.
What on Earth does that mean? The document we have on the "sort"
method makes no reference to this and the calling sequence seems pretty
easy. Here is the failing part of the code....'
'
' This code locates the named address list and sets up the object to
hold
' all the entries until used later to resolve addresses base on
"DisplayName"
'
Dim spAdrLsts As AddressLists
Dim spAdrLst As AddressList
Set spAdrLsts = olns.AddressLists
Set olCFAddressEntries = Nothing
For Each spAdrLst In spAdrLsts
If spAdrLst.Name = olCF.AddressBookName Then
Set olCFAddressEntries = spAdrLst.AddressEntries
Call xlMessage.AddMessage("Found the address list
entries.", "main")
Exit For
End If
Next spAdrLst
Set spAdrLsts = Nothing
Set spAdrLst = Nothing
If (olCFAddressEntries Is Nothing) Then
Call xlMessage.AddMessage("Could not find address list so must
exit.", "main", "error")
Call ReleaseEverything
Exit Sub
End If
Call olCFAddressEntries.Sort("Name", olAscending)
So what is the trick to get the address list sorted?
Thanks in advance for you help.
Bernie
We have a Visual Basic for Applications program that is looking up
names in an address book in order to find the email address. The
program works great but is a bit slow since it is doing a simple look
up on the address entries. For each address starting at the top.
So we thought, hey, there is a "sort" method for the "addressentries"
object, let's call that and now have the list in order and the lookup
becomes much quicker...we don't have to sca the whole thing if the
entry is not there.
However, when attempting the sort method we keep getting the message...
Run-time error '-1834750 (ffee40102)'
IMAPITable::SortTable was called, which this object does not support.
What on Earth does that mean? The document we have on the "sort"
method makes no reference to this and the calling sequence seems pretty
easy. Here is the failing part of the code....'
'
' This code locates the named address list and sets up the object to
hold
' all the entries until used later to resolve addresses base on
"DisplayName"
'
Dim spAdrLsts As AddressLists
Dim spAdrLst As AddressList
Set spAdrLsts = olns.AddressLists
Set olCFAddressEntries = Nothing
For Each spAdrLst In spAdrLsts
If spAdrLst.Name = olCF.AddressBookName Then
Set olCFAddressEntries = spAdrLst.AddressEntries
Call xlMessage.AddMessage("Found the address list
entries.", "main")
Exit For
End If
Next spAdrLst
Set spAdrLsts = Nothing
Set spAdrLst = Nothing
If (olCFAddressEntries Is Nothing) Then
Call xlMessage.AddMessage("Could not find address list so must
exit.", "main", "error")
Call ReleaseEverything
Exit Sub
End If
Call olCFAddressEntries.Sort("Name", olAscending)
So what is the trick to get the address list sorted?
Thanks in advance for you help.
Bernie