A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to remove an addresslist in outlook ?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old June 10th 09, 02:11 PM posted to microsoft.public.outlook.program_vba
Anthony_fr
external usenet poster
 
Posts: 5
Default How to remove an addresslist in outlook ?

Hi all, and sorry for my english

I'm looking how to remove a addresslist in outlook using VB

I want to remove all entry or one entry without using the folder object and
set the ShowAsOutlookAB=False because some time when the folder contact is
corrupt the entry stay in the adresslists

Thanks All for your help


Here my code

Sub Main()
' Create an Outlook application.
Dim oApp As Outlook.Application
Set oApp = New Outlook.Application

' Get the MAPI namespace.
Dim oNS As Outlook.NameSpace
Set oNS = oApp.Session

' Get the AddressLists collection.
Dim oALs As Outlook.AddressLists
Set oALs = oNS.AddressLists
MsgBox (oALs.Count)

' Loop through the AddressLists collection.
Dim i As Integer
Dim oAL As Outlook.AddressList
For i = 1 To oALs.Count
Set oAL = oALs.Item(i)
'
'! Here : how to do oAl.remove ?
'
Next i
End Sub
  #2  
Old June 10th 09, 02:37 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to remove an addresslist in outlook ?

There are no Remove() or Delete() methods either in the AddressLists or
AddressList collection or object. You can get the AddressEntry of the
corrupted object from the AddressList.AddressEntries collection and delete
that if you want.

The only way to set or change ShowAsOutlookAB is to get the folder you want
and clear that Boolean flag property, so at some point to do that you will
need to access the folder.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Anthony_fr" wrote in message
...
Hi all, and sorry for my english

I'm looking how to remove a addresslist in outlook using VB

I want to remove all entry or one entry without using the folder object
and
set the ShowAsOutlookAB=False because some time when the folder contact is
corrupt the entry stay in the adresslists

Thanks All for your help


Here my code

Sub Main()
' Create an Outlook application.
Dim oApp As Outlook.Application
Set oApp = New Outlook.Application

' Get the MAPI namespace.
Dim oNS As Outlook.NameSpace
Set oNS = oApp.Session

' Get the AddressLists collection.
Dim oALs As Outlook.AddressLists
Set oALs = oNS.AddressLists
MsgBox (oALs.Count)

' Loop through the AddressLists collection.
Dim i As Integer
Dim oAL As Outlook.AddressList
For i = 1 To oALs.Count
Set oAL = oALs.Item(i)
'
'! Here : how to do oAl.remove ?
'
Next i
End Sub


  #3  
Old June 10th 09, 04:17 PM posted to microsoft.public.outlook.program_vba
Anthony_fr
external usenet poster
 
Posts: 5
Default How to remove an addresslist in outlook ?

OK thanks for your reply.

but I need a way to do this...

So do you know if I can delete the adress book from my profil and recreate
it whit vb ?
It would reset my adresslist as I want.


Others Ideas are welcome


"Ken Slovak - [MVP - Outlook]" wrote:
There are no Remove() or Delete() methods either in the AddressLists or
AddressList collection or object. You can get the AddressEntry of the
corrupted object from the AddressList.AddressEntries collection and delete
that if you want.

The only way to set or change ShowAsOutlookAB is to get the folder you want
and clear that Boolean flag property, so at some point to do that you will
need to access the folder.

--


  #4  
Old June 10th 09, 05:43 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default How to remove an addresslist in outlook ?

No, there's nothing like that which can be done using code. Just delete the
corrupted contact.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"Anthony_fr" wrote in message
...
OK thanks for your reply.

but I need a way to do this...

So do you know if I can delete the adress book from my profil and recreate
it whit vb ?
It would reset my adresslist as I want.


Others Ideas are welcome


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Addresslist disapperaed after moving to new machine Scanhok Outlook - Using Contacts 1 February 4th 07 10:50 AM
change the first addresslist Clemens Outlook - Installation 1 May 1st 06 02:43 PM
How to search the AddressList? Smitha Nataraj Outlook - Using Forms 0 January 18th 06 04:51 AM
How to search the AddressList for a specific address entry? Smitha Nataraj Outlook - General Queries 0 January 18th 06 04:47 AM
How to search in the AddressList? Smitha Nataraj Add-ins for Outlook 0 January 18th 06 04:46 AM


All times are GMT +1. The time now is 11:16 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.