Solved

VB6 and Outlook

Posted on 2004-08-29
1
240 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

807 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