Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB6 and Outlook

Posted on 2004-08-29
1
Medium Priority
?
246 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 1000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
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…
Suggested Courses

782 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