Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Automated Printing of incoming emails with attachemnts in Outlook 2007?

Posted on 2009-04-13
9
Medium Priority
?
299 Views
Last Modified: 2012-05-06
Hello,

I am trying to configure some of our employees Outlook 2007 to automatically print incoming email attachments without the user having to go into the attachment and printing it.

I would need this function to work only from a specific group of users that send XLS/DOC and XLSX.DOCX file attachments.

Does anyone have a similar setup?

A tool that has worked for us in the past is Print Tools for Outlook from MAPILabs but it does not seem to play nice with Outlook 2007.

Thanks.
0
Comment
Question by:warba
[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
  • 5
  • 4
9 Comments
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 24130499
Hello warba,

Could be set up as a macro ... assuming they are allowed?

Regards,
Chris
0
 
LVL 2

Author Comment

by:warba
ID: 24141177
If the work-around would enable us to print incoming/attachments from a specific group of users, then I could enable macros for the user. How would we go about setting up such a macro?
0
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 375 total points
ID: 24141466
Two stages really:

1. SImply create a rule to run a script for every incoming email.

2. A script that will print the defined types ... i.e. as below which when placed in an ordinary module will print the files automatically on receipt.

Let me know ...

Chris
Function PrintAttachments(mai As mailitem)
Dim objFSO As Object
Dim objTempFolder As Object
Dim olkAttachment As Outlook.Attachment
Dim olkItem As Object
 
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objTempFolder = objFSO.GetSpecialFolder(2)
    For Each olkItem In Application.ActiveExplorer.Selection
        For Each olkAttachment In olkItem.Attachments
            If LCase(Right(olkAttachment.fileName, 3)) = "doc" Or _
                LCase(Right(olkAttachment.fileName, 4)) = "docm" Or _
                LCase(Right(olkAttachment.fileName, 3)) = "xls" Or _
                LCase(Right(olkAttachment.fileName, 4)) = "xlsm" Then
                olkAttachment.SaveAsFile objTempFolder & "\" & olkAttachment.fileName
                ShellExecute 0&, "print", objTempFolder & "\" & olkAttachment.fileName, 0&, 0&, 0&
            End If
        Next
    Next
    
Set olkItem = Nothing
Set olkAttachment = Nothing
Set objTempFolder = Nothing
Set objFSO = Nothing
End Function

Open in new window

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 2

Author Comment

by:warba
ID: 24141940
You mentioned it needs to be placed as an ordinary module, can you explain that?

I am assuming I should plug this into a VB Editor and compile it as a DLL?

Then import into Outlook as an add-in in outlook 2007 ( Trust Center > Add-ins > Com Add-ins > Add) for it to be available as a selection in the custom script window when creating the rule?
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 24142013
Nope.

In the outlook VBE, insert a normal code module, module1 or such, paste the sub therein.  This makes it register for the rule setup.

Chris
0
 
LVL 2

Author Comment

by:warba
ID: 24142436
In Outlook VBE, after inserting the code into a new module, when i try to compile the function it errors out with:

Compile Error: Sub or Function not defined

Function PrintAttachments(mai As mailitem)
Dim objFSO As Object
Dim objTempFolder As Object
Dim olkAttachment As Outlook.Attachment
Dim olkItem As Object
 
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objTempFolder = objFSO.GetSpecialFolder(2)
    For Each olkItem In Application.ActiveExplorer.Selection
        For Each olkAttachment In olkItem.Attachments
            If LCase(Right(olkAttachment.fileName, 3)) = "doc" Or _
                LCase(Right(olkAttachment.fileName, 4)) = "docm" Or _
                LCase(Right(olkAttachment.fileName, 3)) = "xls" Or _
                LCase(Right(olkAttachment.fileName, 4)) = "xlsm" Then
                olkAttachment.SaveAsFile objTempFolder & "\" & olkAttachment.fileName
                ShellExecute 0&, "print", objTempFolder & "\" & olkAttachment.fileName, 0&, 0&, 0&
            End If
        Next
    Next
   
Set olkItem = Nothing
Set olkAttachment = Nothing
Set objTempFolder = Nothing
Set objFSO = Nothing
End Function

I have also tried just saving this VB, and creating the rule, but the custom script does not appear in the list, which I would assume is because it has not been compiled yet.
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 24144833
I assume the bold text is significant yet the previous line also uses the objtempfolder object, and the whole script apart from the isolation to excel/word has worked in a  number of questions. As I have so many draft and test functions I cannot begin to compile my project but it should be visible when defining the rule without compilation.

Chris
0
 
LVL 2

Author Comment

by:warba
ID: 24153609
Thanks for the reply Chris, this worked.
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 24154632
Glad it helped though a 'B' grade would be disappointing for 500 points never mind 125.  Ho-Hum you're in charge I suppose.

Chris
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

688 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