Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Interfacing with MicroSoft Outlook through vb

Status
Not open for further replies.

eswhite

Programmer
Jul 6, 2000
18
US
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.

Thanks,
Eric
 
Use your lbect browser and that will give the methods available in MAPI you can to print your email out

Randy
 
Hi,

Here's a proc :


Sub GetContactList()

On Error GoTo Test_Error

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

Follow the white rabbit to the ms outlook objects def'ns.

Ciao
Phathi >:):O>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top