Solved

VB6 and Outlook

Posted on 2004-08-29
1
239 Views
Last Modified: 2010-05-02
Could some one give me an example of how to iterate through the inbox in Outlook, and open an email to read the body contents?  
0
Comment
Question by:jcorbin
1 Comment
 
LVL 8

Accepted Solution

by:
mladenovicz earned 250 total points
ID: 11925281
Private Sub Form_Load()
Dim oOutlook    As Outlook.Application
Dim oNs         As Outlook.NameSpace
Dim oFldr       As Outlook.MAPIFolder
Dim oMessage    As Outlook.MailItem

    Set oOutlook = New Outlook.Application
    Set oNs = oOutlook.GetNamespace("MAPI")
    Set oFldr = oNs.GetDefaultFolder(olFolderInbox)

    For Each oMessage In oFldr.Items
        Debug.Print oMessage.Body
    Next oMessage
 
    Set oMessage = Nothing
    Set oFldr = Nothing
    Set oNs = Nothing
    Set oOutlook = Nothing
End Sub

You will need reference to the Microsoft Outlook Object Library
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question