Solved

VB6 and Outlook

Posted on 2004-08-29
1
237 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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now