Does anyone know where I can look to find information on how to print a range of emails from Microsoft Outlook pst file. I would like to do something
quick in VB.
Dim oOutlook As Outlook.Application
Dim oNameSpace As NameSpace
Dim oContactFolder As Object
Set oOutlook = GetObject(, "Outlook.Application"
Set oNameSpace = oOutlook.GetNamespace("MAPI"
Set oContactFolder = oNameSpace.GetDefaultFolder(olFolderContacts)
For Each oOutLookAdr In oContactFolder.Item
List1.AddItem oOutLookAdr.FullName & " - " & _
oOutLookAdr.Email1Address
Next
Exit Sub
Test_Error:
Select Case Err
Case 429
' If Outlook isn't opened already
'open a new session.
Set oOutlook = New Outlook.Application
Resume Next
Case Else
MsgBox Err.Description,vbExclamation
End Select
End Sub
Then Run it :
Private Sub Command1_Click()
' This will add all contacts from the Outlook contact database
' in the ListBox
GetContactList
End Sub
You'll obviusly have to create references to ms outlook,listboxes and stuff
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.