Newbie needs help

Status
Not open for further replies.
J

Jim

I am trying to save the body of an email to a text file using vba code

Would someone kindly post the code so that I can use it as a worked example

I'm using WinXP and Outlook 2003

Regards & TIA
 
C

Charlize

VBA Code:

------------------
Sub save_selection_mails_to_txt()

'The message you want to process

Dim MyMessage As Outlook.MailItem

'a number

Dim myItem As Long

Dim save_it As String

'if selection isn't present, don't do a thing

'you could build an extra check if the class

'of the selected item is a message or not

'because there are read receipt and taskitems in mailbox

If ActiveExplorer.Selection.Count < 1 Then

MsgBox "Select at least one mailmessage", vbInformation

Exit Sub

End If

For myItem = 1 To ActiveExplorer.Selection.Count

Set MyMessage = ActiveExplorer.Selection.item(myItem)

save_it = MyMessage.ReceivedTime

'when using dates with /

save_it = Replace(save_it, "/", "_")

'when using hours with :

save_it = Replace(save_it, ":", "-")

'c:\txt-mails must be present as a directory

MyMessage.SaveAs "c:\txt-mails\" & save_it & " -- " & MyMessage.SenderName & ".txt", olTXT

'go to next selected mail

Next myItem

End Sub

------------------
Charlize
 
J

Jim

Many thanks ... That is exactly what I needed to get me started.

Regards

Jim
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
C Newbie needs help with Outlook Macro Outlook VBA and Custom Forms 3
O Newbie question: how to sync two Outlook -Exchange and IMAP- calendars? Using Outlook 4
J Newbie confusion Using Outlook 0
E Newbie, desperately seeking help Using Outlook 2
S Seperating email accounts, Syncronizing, and a few newbie questions Using Outlook 5
C Newbie import issues Using Outlook 3
A General, how to get started? [kwrds begin start newbie] Outlook VBA and Custom Forms 3
R Newbie Redemption ISafeMailItemPtr question Outlook VBA and Custom Forms 6
R Newbie get_CurrentItem() question Outlook VBA and Custom Forms 6
Y Newbie : What is http://schemas.microsoft.com all about? Outlook VBA and Custom Forms 2
A Arthur needs help with 2007 Outlook e-mail Using Outlook.com accounts in Outlook 3
lotsbg Loads of junk in second email needs fixing Using Outlook 1
R Narcotics Police Officer Needs help Using Outlook 1
Y Changing colour of selection bar in Outlook (too light, needs to be grey) Using Outlook 4
J To-do bar needs to show appointments from multiple calendars Outlook Wishlist 3
C Beginner Needs VBA Help in Modifying Code Outlook VBA and Custom Forms 2
Forum Admin What needs fixing in Outlook? Outlook Wishlist 18
S HTML to Plain Text Macro - Help Outlook VBA and Custom Forms 1
e_a_g_l_e_p_i Outlook 2010 Help setting up Gmail account in Outlook 2010 Using Outlook 3
N Help creating a VBA macro with conditional formatting to change the font color of all external emails to red Outlook VBA and Custom Forms 5
Y Filter unread emails in a search folder vba help Outlook VBA and Custom Forms 0
L Need help modifying a VBA script for emails stuck in Outbox Outlook VBA and Custom Forms 6
F Microsoft Outlook Connector 14.0.6123.5001 - Help! Using Outlook 6
witzker Pls help to change the code for inserting date in Ol contact body Outlook VBA and Custom Forms 5
R Disable conversation thread from replying of recipients in the same subject. Please help Using Outlook 0
R seperate read layout to design in outlook 2016..Help!! Outlook VBA and Custom Forms 3
O Help .. got lost ... installing Office like 2016 Using Outlook 5
R Help Revising VBA macro to delete email over different time span Outlook VBA and Custom Forms 0
Marc2019 Need help please! Cannot Setup my outlook email account on my Mac Outlook 2011 Using Outlook.com accounts in Outlook 2
L Attachment saving and tracking - PLEASE help! Outlook VBA and Custom Forms 5
I Help with dates in task list. Using Outlook 5
C need help setting up outlook first time Using Outlook 1
K To do bar help Using Outlook 8
M Help sending email but removing signature via VBA Outlook VBA and Custom Forms 5
S help with outlook scripting Outlook VBA and Custom Forms 4
J Help Please!!! Outlook 2016 - VBA Macro for replying with attachment in meeting invite Outlook VBA and Custom Forms 9
EmelineGueguen Help to understand the problem of work Using Outlook 1
N Outlook Forms Help Outlook VBA and Custom Forms 2
N Need help syncing contacts to iPhone X Using Outlook 8
S VBA Macro - Run-time error '424': object required - Help Please Outlook VBA and Custom Forms 3
broadbander Needing help with reply/reply all while keeping attachments and adding a new CC recipient. Outlook VBA and Custom Forms 5
J Help! My contacts have disappeared. Using Outlook 5
J HELP- Rule to auto strip prepend from external emails Using Outlook 0
J Help Needed With Multi-Step Login Email Address Using Outlook.com accounts in Outlook 1
G Bcc help - Preventing multiple forwards from a bcc'd distribution group Using Outlook 1
G [Help] Converting array to destination folder path Outlook VBA and Custom Forms 1
K Help.... Office Outlook 2016 Using Outlook 1
S Error using AddressEntry.GetContact - need help Outlook VBA and Custom Forms 2
D Help with code to move mail on receipt to another folder based on time received Outlook VBA and Custom Forms 2
E Outlook 2010 need help with rules Using Outlook 0

Similar threads

Top