Export Email as TXT from Outlook (not OE)

C

Christine Lee

Hi,
Trying to automate exporting Outlook emails as a text
file to a folder on my HD (or a folder called Sample).
The folder I wish to export from is a Hotmail folder that
is read in Outlook (not OE). I'd like to make a macro or
VBA that attaches to a button to make it simple for the
user.

From there, I would like to use, Visual Basic's Freefile
function to sort through the text and find key pieces of
data. Using ADO, I'd like to add that data to an MS
Access XP database. (I have this code, just sharing the
scope of the project w/the reader.)

I cannot find how to programaically do this with Outlook.

I have intermediate VB/VBA skills. Beginner skills in
C/C++ programming. Vague knowledge of JAVA and VB script.

Would some one recommend:
a. at least how to create a button that will save all the
emails in the current folder to my HD as text.
b. offer code or suggestion of a better way to do this
c. make any relevant comment on this.

Thanks for taking time to look at my issue! Have a great
day. Christine
 
H

Helmut Obertanner

This is how you could do it from Outlook via macro:

Sub saveEmailTxt()
Dim objItem As Object
Dim iCount As Integer

'iterate over all Items in the current folder and save the body as textfile
in c:\
For Each objItem In ActiveExplorer.CurrentFolder.Items
objItem.SaveAs "C:\Mail" & CStr(iCount) & ".txt", olSaveAsText
iCount = iCount + 1
Next

End Sub


if you dont want to have a security warning or want to have a button you
have to create ad AddIn.


--
regards,
Helmut Obertanner
DATALOG Software AG
http://www.datalog.de
[obertanner at datalog dot de]
 
Joined
Sep 26, 2012
Messages
6
Reaction score
0
This is how you could do it from Outlook via macro:

Sub saveEmailTxt()
Dim objItem As Object
Dim iCount As Integer

'iterate over all Items in the current folder and save the body as textfile
in c:\
For Each objItem In ActiveExplorer.CurrentFolder.Items
objItem.SaveAs "C:\Mail" & CStr(iCount) & ".txt", olSaveAsText
iCount = iCount + 1
Next

End Sub


if you dont want to have a security warning or want to have a button you
have to create ad AddIn.


--
regards,
Helmut Obertanner
DATALOG Software AG
http://www.datalog.de
[obertanner at datalog dot de]


"Christine Lee" <[email protected]> schrieb im Newsbeitrag
news:[email protected]...
> Hi,
> Trying to automate exporting Outlook emails as a text
> file to a folder on my HD (or a folder called Sample).
> The folder I wish to export from is a Hotmail folder that
> is read in Outlook (not OE). I'd like to make a macro or
> VBA that attaches to a button to make it simple for the
> user.
>
> From there, I would like to use, Visual Basic's Freefile
> function to sort through the text and find key pieces of
> data. Using ADO, I'd like to add that data to an MS
> Access XP database. (I have this code, just sharing the
> scope of the project w/the reader.)
>
> I cannot find how to programaically do this with Outlook.
>
> I have intermediate VB/VBA skills. Beginner skills in
> C/C++ programming. Vague knowledge of JAVA and VB script.
>
> Would some one recommend:
> a. at least how to create a button that will save all the
> emails in the current folder to my HD as text.
> b. offer code or suggestion of a better way to do this
> c. make any relevant comment on this.
>
> Thanks for taking time to look at my issue! Have a great
> day. Christine




Is it possible to write all mails in a single text file...?
 
Joined
Jun 19, 2014
Messages
1
Reaction score
0
This is a wonderful discovery for me first of all!!!! It make me very excited!! :thumb:

Now than I am through gushing......

I need to take this script one step further. I would like to specify a specific folder or from:emailaddress as well as after the script has run move the exported message to another folder. I must keep the message for archival purposes. If there is a way I can specify the folder for the script to run then I would like to use it in a rule. so It can run automagically and I dont have to worry about manually doing this every time I get an email.

Thank you for any assistance you can provide!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top