Hey, Was wondering if someone could lend a hand. I have some VBA code for outlook that allows me to take all the attechments in a selected folder and save them as a .TXT file from xml. I am ultimately looking to add all the data into an excel database but first must switch all the text for the files (around 1000 of them). I only need to change the characters "<" and ">" to "^" so that I can import them as a "^" delimited file to excel. Would like to do this in the same application as my outlook attachment save which is done as follows:
Sub saveAttachments()
Dim myOlApp As Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myAttachment As Outlook.Attachment
Dim myItems As Outlook.Items
Dim strFolder As String
Dim myFolder As Object
Dim myExplorer As Outlook.Explorer
Dim obj As Outlook.MailItem
Dim LResult As String
On Error Resume Next
strFolder = "H:\DUMP\"
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
'Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myFolder = myNameSpace.PickFolder
Set myExplorer = myFolder.GetExplorer
Set myItems = myFolder.Items
'myExplorer.Display
For Each obj In myItems
For Each myAttachment In obj.Attachments
myAttachment.SaveAsFile strFolder _
& myAttachment.DisplayName & ".TXT"
Next
Next
Set myOlApp = Nothing
Set myNameSpace = Nothing
Set myFolder = Nothing
Set myExplorer = Nothing
Set myItems = Nothing
End Sub
Please help me! I am not even sure where to begin
J
Sub saveAttachments()
Dim myOlApp As Outlook.Application
Dim myNameSpace As Outlook.NameSpace
Dim myAttachment As Outlook.Attachment
Dim myItems As Outlook.Items
Dim strFolder As String
Dim myFolder As Object
Dim myExplorer As Outlook.Explorer
Dim obj As Outlook.MailItem
Dim LResult As String
On Error Resume Next
strFolder = "H:\DUMP\"
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
'Set myFolder = myNameSpace.GetDefaultFolder(olFolderInbox)
Set myFolder = myNameSpace.PickFolder
Set myExplorer = myFolder.GetExplorer
Set myItems = myFolder.Items
'myExplorer.Display
For Each obj In myItems
For Each myAttachment In obj.Attachments
myAttachment.SaveAsFile strFolder _
& myAttachment.DisplayName & ".TXT"
Next
Next
Set myOlApp = Nothing
Set myNameSpace = Nothing
Set myFolder = Nothing
Set myExplorer = Nothing
Set myItems = Nothing
End Sub
Please help me! I am not even sure where to begin
J