Email attachment retrieval to excel

cpg29

New Member
Joined
Mar 16, 2006
Messages
13
Hi Every one,

I have spent some time reviewing the message board and have had no success solving my dilemma.

Questions is as follows: Emails with excel attachments come into my Outlook subfolder. I would like to be able to retrieve these attachments and save them to a seperate location. Can this be done?

All help is greatly appreciated.

Regards
:LOL:
 

Some videos you may like

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

respree

Active Member
Joined
Apr 14, 2003
Messages
258
Click on the Excel icon (while reading the e-mail) to retrieve the file (a nd open Excel). Then "File > Save As" when you want to save it.
 

cpg29

New Member
Joined
Mar 16, 2006
Messages
13
I'm looking for an automated solution, I have over 200 files to save down.

Thanks
 

cpg29

New Member
Joined
Mar 16, 2006
Messages
13
Found a solution on the web

Sub SaveAttachments()

Dim olApp As Outlook.Application
Dim olNs As Namespace
Dim Fldr As MAPIFolder
Dim MoveToFldr As MAPIFolder
Dim olMi As MailItem
Dim olAtt As Attachment
Dim MyPath As String
Dim i As Long

Set olApp = New Outlook.Application
Set olNs = olApp.GetNamespace("MAPI")
Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
Set MoveToFldr = Fldr.Folders("P")
MyPath = "C:\My Documents\Completed Survey\"

For i = Fldr.Items.Count To 1 Step -1
Set olMi = Fldr.Items(i)
If InStr(1, olMi.Subject, "Test") > 0 Then
For Each olAtt In olMi.Attachments
If olAtt.Filename = "2003.xls" Then
olAtt.SaveAsFile MyPath & olMi.SenderName & ".xls"
End If
Next olAtt
olMi.Save
olMi.Move MoveToFldr
End If
Next i

Set olAtt = Nothing
Set olMi = Nothing
Set Fldr = Nothing
Set MoveToFldr = Nothing
Set olNs = Nothing
Set olApp = Nothing

End Sub
 

bsnapool

Active Member
Joined
Jul 10, 2006
Messages
452

ADVERTISEMENT

Just out of interest how did u get this code to work?
 

cpg29

New Member
Joined
Mar 16, 2006
Messages
13
Source of code with descriptions can be found on www.dicks-clicks.com (site name is legit)
 

Watch MrExcel Video

Forum statistics

Threads
1,113,809
Messages
5,544,419
Members
410,610
Latest member
renatha prado
Top