|
|
Title | Extract email from Outlook Express |
Description | This 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. |
Keywords | Outlook Express, email, automation, extract email |
Categories | Office, 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:
Key | Effect |
Alt-F | Opens the file menu |
A | Save As |
(number) | The name of the file to save as |
Enter | Accept the Save As dialog |
Down Arrow | Move 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
|
|
|
|
|
|