Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88066

Runtime Error 91 : Export Global contact list in outlook 2016

$
0
0

Now I'm export Global contact list in outlook 2016. to Excel file. This's my code:

 Sub ExportOutlookAddressBook()
 Application.ScreenUpdating = False
 Dim olApp As Outlook.Application
 Dim olNS As Outlook.Namespace
 Dim olAL As Outlook.AddressList
 Dim olEntry As Outlook.AddressEntry

 Set olApp = Outlook.Application
 Set olNS = olApp.GetNamespace("MAPI")
 Set olAL = olNS.AddressLists("Global Address List") 'Change name if different contacts list name
 ActiveWorkbook.ActiveSheet.Range("a1").Select
 For Each olEntry In olAL.AddressEntries
 'ActiveCell.Value = olEntry.GetContact.FullName 
 ActiveCell.Offset(0, 0).Value = olEntry.Name
 ActiveCell.Offset(1, 0).Select
 Next olEntry
 Set olApp = Nothing
 Set olNS = Nothing
 Set olAL = Nothing
 Application.ScreenUpdating = True
 End Sub

It have Runtime Error 91!.How can I Fix this Error? >/\<

This's my Global contact list.

This's my result


Viewing all articles
Browse latest Browse all 88066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>