Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
TitleExtract email from Outlook Express
DescriptionThis example shows how to extract email messages from Outlook Express into text files in Visual Basic 6. It uses AppActivate to activate Outlook Express and uses SendKeys to send it keys that make it extract the email messages.
KeywordsOutlook Express, email, automation, extract email
CategoriesOffice, Utilities
 
The program uses AppActivate to activate Outlook Express. It uses the title bar caption you enter into a text box. This value changes depending on the folder you are viewing in Outlook Express.

The program waits a bit so Outlook Express can activate. Then it uses SendKeys to repeatedly sends these keys to the application:

KeyEffect
Alt-FOpens the file menu
ASave As
(number)The name of the file to save as
EnterAccept the Save As dialog
Down ArrowMove to the next email message
 
Private Sub cmdExtractEmails_Click()
Dim num_emails As Integer
Dim first_num As Integer
Dim i As Integer

    ' Activate Outlook Express.
    AppActivate txtAppTitle.Text
    Pause 1

    ' Process the messages.
    num_emails = CInt(txtNumEmails.Text)
    first_num = CInt(txtFirstEmailNum.Text)
    For i = 1 To num_emails
        SendKeys "%F", True
        SendKeys "A", True
        SendKeys Format$(i + first_num - 1, "000"), True
        SendKeys "{Enter}", True
        SendKeys "{Down}", True

        Me.Caption = i
        DoEvents
    Next i

    Me.SetFocus
    MsgBox "Done"
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated