Solved

Macro to copy file attachment to c:  drive on incoming mail part 2

Posted on 2013-01-09
23
340 Views
Last Modified: 2013-01-17
0
Comment
Question by:route217
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 14
  • 9
23 Comments
 
LVL 30

Expert Comment

by:gowflow
ID: 38760312
Well you tell me what would you require:
1) I can adapt it so it is run from outlook and not Excel and still do 1 file at a time like you highlight the file, press on a button this time in outlook and it will save it to disk.
2) Would you like when the button is pressed to process an entire folder ?? then this is what I need to know what option you want to ?

gowflow
0
 

Author Comment

by:route217
ID: 38760420
Glow flow can you change the macro so - as the email arrive into outlook folder cm template folder the attachment automatically get copied to the c: drive and a copy of the email remains in read in outlook....
0
 
LVL 30

Expert Comment

by:gowflow
ID: 38760622
I see so you want to monitor the folder for incoming emails and then apply the macro. OK I need a snapshot of your outlook folders that show the CM template folder I need to see at what level is this folder can you open outlook and exapnd folders so I see clearly where is cm template in the personal or other folders and take a snapshot.
Press on you pc on Prt SC it is usually after F12 or somwhere there then open Paint and do CTRL V and save the file as .jpeg and attach it here.
gowflow
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 30

Accepted Solution

by:
gowflow earned 500 total points
ID: 38760968
I like to go one step at a time. Pls load this file it has now an additional button
'Save Attachements from selected folder' again, open outlook, select now a specific folder on the left pane not an email, and then click on this button and see the results. Let me know.
gowflow
saveattachments.xls
0
 

Author Comment

by:route217
ID: 38761151
Thanks glow flow - let me test the file
0
 
LVL 30

Expert Comment

by:gowflow
ID: 38769792
did u had a chance to test the file ?
gowflow
0
 

Author Comment

by:route217
ID: 38775619
apologies glow flow.....

testing tomorrow internet problems and computer problems too
0
 
LVL 30

Expert Comment

by:gowflow
ID: 38776051
ok no problem
gowflow
0
 

Author Comment

by:route217
ID: 38777420
Glow flow

Two questions:-

1. My incoming email folder is called CMU Template which I gave changed the code to accommodate

2. How do I change the file path where the attachments are saved on c: drive?

And finally what do the two macro buttons do?
0
 

Author Comment

by:route217
ID: 38777422
Getting a comple error user- defined type not defined

Public Sub SaveAttachment ()
Dim objOL as Outlook .Application
0
 
LVL 30

Expert Comment

by:gowflow
ID: 38777469
ok here are the answers:

=======================================
And finally what do the two macro buttons do?
=======================================
>>>>
Button: Save Email Attachments to documents on C
Let you save 1 single Email Attachment that is SELECTED in Outlook.

Button: Save Attachment from Selected Folder
Let you save 1 Entire Folder's Emails Attachment that is SELECTED in Outlook

In other words you open Outlook you select either 1 email that you wish to save its attachment or an entire folder (yellow folder on the left pane in outlook) and it will go thru all the emails and when it finds an Attachmnent it saves the attachment in the C folder specified in the macro. No specific Email or Folder name has been hardcoded in the macro you may choose any repeat any email or any folder Inbox, Sent Items CM Template XYZ Company any Folder that you like and press the button and it will go thru all the emails that exist in that folder and save them to disk !!!!

================================================================
2. How do I change the file path where the attachments are saved on c: drive?
================================================================
>>>>
All results of the macro are saved (like you requested in your Documents on C under folder OLAttachments. If you want this user set we can make the change or else you will need to change the code in both Subs SaveAttachments and SaveAttachmentsFmFolder at this line

strFolderpath = strFolderpath & "\OLAttachments"

Example if you wanted in C:\Test\Attachments then it will be
strFolderpath = "C:\Test\Attachments"

=============================================
Getting a comple error cannot find project or library...

Public Sub SaveAttachment ()
Dim objOL as Outlook .Application
=============================================
>>>>>
Load the file open goto VBA and on the Tolls Menu select References and in the list that is opened locate
Microsoft Outllook 12.0 or 14.0 Library and tick on it press ok close and save the workbook and start it again. You should not get an error.

Let me know results.
gowflow
0
 

Author Comment

by:route217
ID: 38777480
Ok worked put error and what buttons do....
But I can find the saved attachment on the c: drive as an excel file ????
0
 

Author Comment

by:route217
ID: 38777641
Excellent and apologies for being a pain...
0
 
LVL 30

Expert Comment

by:gowflow
ID: 38777677
great. Let me know here if you need to post a new question to refine this or change it I will be glad to assist. Pls post here a link to a new question u may need help with.
gowflow
0
 

Author Comment

by:route217
ID: 38778576
Hello glow flow ...

How would amend the following question to show as a jpg as opposed to HTML output

http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_27995923.html
0
 

Author Comment

by:route217
ID: 38779852
Hi Glow flow

Any thoughts on the above question?

Regards
0
 
LVL 30

Expert Comment

by:gowflow
ID: 38780610
Well I looked it up but cannot run the code as dependant can't you post a workbook maybe as only the coould not too much helpful
gowflow
0
 

Author Comment

by:route217
ID: 38781737
Hi Glow flow

The first code should work prefect fine.   It's the second code that has the availability to covert image to jpg... Not sure how to modify my hTMl section..

Unable to post workbook restrictions
0
 

Author Comment

by:route217
ID: 38782178
Glow flow I am going to delete the questions as above link unless u are working on it - then apologies...

Need to look at a different approach to tackle this....
0
 
LVL 30

Expert Comment

by:gowflow
ID: 38782641
ok no problem I am not looking at it. Go ahead and delete it. I will keep this link open for you case u need assistance in an other question feel free to post a link here.
gowflow
0
 

Author Comment

by:route217
ID: 38788215
Hi Glow Flow

This is the main question that is driving me round the bend...
Original code provided by the Guru Rorya

http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_27998830.html

Explanation see question
0
 

Author Comment

by:route217
ID: 38789491
Hi glow flow

Any feedback on these two question - how to tackle thm..
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question