Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 346
  • Last Modified:

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

0
route217
Asked:
route217
  • 14
  • 9
1 Solution
 
gowflowCommented:
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
 
route217Author Commented:
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
 
gowflowCommented:
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
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!

 
gowflowCommented:
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
 
route217Author Commented:
Thanks glow flow - let me test the file
0
 
gowflowCommented:
did u had a chance to test the file ?
gowflow
0
 
route217Author Commented:
apologies glow flow.....

testing tomorrow internet problems and computer problems too
0
 
gowflowCommented:
ok no problem
gowflow
0
 
route217Author Commented:
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
 
route217Author Commented:
Getting a comple error user- defined type not defined

Public Sub SaveAttachment ()
Dim objOL as Outlook .Application
0
 
gowflowCommented:
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
 
route217Author Commented:
Ok worked put error and what buttons do....
But I can find the saved attachment on the c: drive as an excel file ????
0
 
route217Author Commented:
Excellent and apologies for being a pain...
0
 
gowflowCommented:
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
 
route217Author Commented:
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
 
route217Author Commented:
Hi Glow flow

Any thoughts on the above question?

Regards
0
 
gowflowCommented:
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
 
route217Author Commented:
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
 
route217Author Commented:
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
 
gowflowCommented:
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
 
route217Author Commented:
0
 
route217Author Commented:
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
 
route217Author Commented:
Hi glow flow

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

Featured Post

Technology Partners: 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!

  • 14
  • 9
Tackle projects and never again get stuck behind a technical roadblock.
Join Now