warba
asked on
Automated Printing of incoming emails with attachemnts in Outlook 2007?
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.
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.
ASKER
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?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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?
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?
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
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
ASKER
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
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.Fi leSystemOb ject")
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.Dim objFSO As Object
Dim objTempFolder As Object
Dim olkAttachment As Outlook.Attachment
Dim olkItem As Object
Set objFSO = CreateObject("Scripting.Fi
Set objTempFolder = objFSO.GetSpecialFolder(2)
For Each olkItem In Application.ActiveExplorer
For Each olkAttachment In olkItem.Attachments
If LCase(Right(olkAttachment.
LCase(Right(olkAttachment.
LCase(Right(olkAttachment.
LCase(Right(olkAttachment.
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 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
Chris
ASKER
Thanks for the reply Chris, this worked.
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
Chris
Could be set up as a macro ... assuming they are allowed?
Regards,
Chris