PDA

View Full Version : vba to do several jobs



steve1000
09-19-2009, 02:18 AM
Morning guys,

first post,
we have been receiving 4 emails a day with orders in them as pdf attachments; this is set to increase to 400 emails a month..

I am looking to create a macro or script to do the following.

new mail comes in

print the attachment
mark as read
move the mail to subfolder (create if does not exsist)
and prehaps save a copy to a network drive.....

most of the attachments are pdf format

I have been looking over the last week there are bits, its putting the things together that baffles me...
I have been messing with vba for about 6 months with excel, first go with outlook.
:dunno

cheers in advance

steve

JP2112
09-22-2009, 11:24 AM
See http://www.codeforexcelandoutlook.com/outlook-vba/stock-event-code/ for sample event code you can adapt for your needs.

To print a PDF using VBA, see http://www.tek-tips.com/viewthread.cfm?qid=1186576&page=1

To mark a MailItem as Read, just set the UnRead property to False.

To move a MailItem to another folder, call the Move method and pass a MAPIFolder object as the parameter. See http://www.codeforexcelandoutlook.com/blog/2008/12/look-for-and-create-folders-programmatically-in-outlook/ for sample code that can be used to check for a given folder and create it if it doesn't exist.

As far saving a copy, do you mean save a copy of the attachment, or the email?

--JP

steve1000
09-22-2009, 12:05 PM
Hey JP

save a copy of the attachment

are you JP from codeforexcelandoutlook ?

I was searching your site over the weekend and using the bits and pieces,

Ilike the triage code

my knowledge is limited its combining all the codes together I am having problems with :doh:

cheers
for the advice
steve

JP2112
09-22-2009, 04:20 PM
The same. Thanks for visiting!

The stock event code makes it easy, most of the code is written. You just have to make a few customizations (where indicated).

steve1000
10-20-2009, 11:58 AM
The same. Thanks for visiting!

The stock event code makes it easy, most of the code is written. You just have to make a few customizations (where indicated).

Hey JP,

do you fancy earning a few dollars by helping out
I can get the bits of code working seperatley, but can not figure out how to combine all the code together ...

Also thought about a button or a keyboard short cut to do this #

:hi:

Steve

JP2112
10-20-2009, 05:07 PM
Sure, just email me through the website:

http://www.codeforexcelandoutlook.com/contact/

steve1000
10-28-2009, 04:29 PM
Hey JP,

You around!

Do you need any more info form me?

Ref this post and the posts I made through your site!

cheers

steve :hi:

JP2112
10-29-2009, 03:39 PM
Yes, but you have to contact me through the site, I don't conduct business in public. ;)

steve1000
10-29-2009, 03:47 PM
Yes, but you have to contact me through the site, I don't conduct business in public. ;)

Hi JP

I have sent to mails to you through the link you posted :wot :dunno

JP2112
10-30-2009, 04:15 AM
Send me a PM through this board with your email address.