Hellow gang,
New to VBA on Outlook. Can sobody share or point me to a place to start
on this....
I need a function or Sub to export personal folders to text file in the
following formatt.
[msg subject]
.
[msg Body]
.
.
.
****************************************************
[msg subject]
.
[msg Body]
Muxer, I wrote the following macro last month to do something similar.
I wanted a list of all the attachments to all the messages in the
current folder. It is close to what you need, I think. Note that I
have Windows 2000, which might affect the Shell command in the last
line.
Steven
' ======================================
Sub SummarizeAttachments()
' Started Feb. 4, 2004, by Steven M
' This Outlook macro checks the current Outlook folder for messages
' with attached files (of any type) and saves a summary to disk.
Dim thisFolder As MAPIFolder
Dim Item As Object
Dim Atmt As Attachment
Dim FileName As String
Dim i As Integer
Set thisFolder = Application.ActiveExplorer.CurrentFolder
If thisFolder.Items.Count = 0 Then
MsgBox "There are no messages in this folder.", _
vbInformation, "Nothing Found"
Exit Sub
End If
Const SummaryPath = "C:\Attach"
Dim SummaryDate As String, SummaryFilename As String
SummaryDate = Replace(FormatDateTime(Date) & "-" & _
FormatDateTime(Time, vbShortTime), "/", "-")
SummaryDate = Replace(SummaryDate, " ", "_")
SummaryDate = Replace(SummaryDate, ":", ";")
SummaryFilename = SummaryPath & thisFolder.Name & "_" _
& SummaryDate & ".txt"
Open SummaryFilename For Output As #2
Print #2,
Print #2, " Summary of attachments to email messages"
Print #2, " Folder: ", thisFolder.Name
Print #2, " Date: ", SummaryDate
Print #2,
' Check each message for attachments
i = 0
For Each Item In thisFolder.Items
If Item.Attachments.Count > 0 Then
i = i + 1
Print #2, "Item: ", i
Print #2, "From:", Item.SenderName
Print #2, "To:", Item.To
Print #2, "Sent:", Item.SentOn
Print #2, "Subject:", Item.Subject
Print #2, "Attachments: ("; Item.Attachments.Count; ")"
For Each Atmt In Item.Attachments
Print #2, , Atmt.FileName
Next Atmt
Print #2,
End If
Next Item
Close
Shell ("C:\WINNT\system32\Notepad.exe " & SummaryFilename)
End Sub