How to save an attached file of Outlook into a specific location

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I receive daily an email with a attached file from my Outlook inbox. This
file must be saved into a specific location manually. I made an app to
automate this process.

My app can read the emails from the inbox folder, I can catch all properties
of the emails. I want to know how to save the attached file into a specific
location.

Anyone can give a help?

Thanks in advance
 
I found the below codes work for me:
Dim oAttachs As Ol.Attachments = oMsg.Attachments
Dim oAttach As Ol.Attachment
Debug.WriteLine("ATTACHED FILE: " &
oAttachs.Count)

If oAttachs.Count > 0 Then
For Each oAttach In oAttachs
'Dim file As New
System.IO.StreamWriter("c:\temp\mt940_test.txt", True)
Try

oAttach.SaveAsFile("c:\temp\mt940_test.txt")
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try

'file.WriteLine(oAttach.DisplayName)
'file.Close()
Next
End If
 

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

Back
Top