Auto printing unread email + attachments in Inbox - Outlook 2010 - (New user)

Lee01

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Hi , very new to outlook, very new to creating macros etc so have used this forum really helpful the last few weeks :)

Problem -

I have staff who have multiple accounts in Outlook 2010 - a personal account and then shared accounts.

The shared accounts receive customer communications - over 1000 each per day and all with PDF attachments which need to be printed. The email + attachment then needs to be filed in Outlook 2010. I want to automate this as much as possible.

What I've done so far is:

1. Used the rules to set the print and then file conditions as well as setting print options to print attachments. Result being incoming email is printed as well as the attachment. Both are then filed.

- Seems to work fine however when testing for quality there is a problem where many PDFs are not printed - seemingly a random thing - the file sizes are all similar, file names are all similar. Doesn't seem to be a printer issue as the printer is printing all the emails but only some of the PDFs.

- I then found the 'quick print' feature in Outlook and tried using that whilst manually selecting each email one at a time and found the same thing - all the email pages work but PDFs are missed here and there.

So my question here is ?

- is this an Outlook problem do you think and if so, how would you go about solving it?

2. So then thinking maybe there is a bug in the 'rules' I thought I'd try using the VB editor. ( very new to this )

- I've found and used the following to tell Outlook to print all unread mail arriving in the Inbox. Tested on my account at works fine.

Private WithEvents Items As Outlook.Items

Private Sub Application_Startup()

Dim Ns As Outlook.NameSpace

Set Ns = Application.GetNamespace("MAPI")

Set Items = Ns.GetDefaultFolder(olFolderInbox).Items

End Sub

Private Sub Items_ItemAdd(ByVal Item As Object)

If TypeOf Item Is Outlook.MailItem Then

PrintNewItem Item

End If

End Sub

Private Sub PrintNewItem(Mail As Outlook.MailItem)

On Error Resume Next

If Mail.UnRead Then

Mail.PrintOut

End If

End Sub

My questions are:

1. How do I define the right inbox to apply the macro to? I'm thinking it may default to the staff members personal account unless I say otherwise?

2. What would I need to add to the above in order to also file the email + attachment once printed. Or can I somehow leave the above as is and then use the rules to auto file the emails once the above has finished running - not sure if this would work?

So my preference would be to solve the missing PDF issue and stick with using the rules - my staff would be more comfortable using those screens to turn it on / off as opposed to macros / VB editor etc - any other options to automate these tasks?

Thankyou..!
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Re: Auto printing unread email + attachments in Inbox - Outlook 2010 - (New us

This line controls the folder:

Set Items = Ns.GetDefaultFolder(olFolderInbox).Items

You'll need the function at Working with VBA and non-default Outlook Folders - Slipstick Systems and will replace the line above with

Set Items = GetFolderPath("mailbox display name\Inbox").Items

I'd file it from the macro.

After PrintNewItem Item, do something like this - assuming it is a subfolder of the inbox. The link above has other examples or use getfolderpatrh to move it to a different data file.

Set destFolder = Session.GetDefaultFolder(olFolderinbox).Folders ("Printed")
item.Move destFolder
 

Top