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

x
?
Solved

Printing multiple e-mails with multiple attachments in consequitive order.

Posted on 2006-06-23
12
Medium Priority
?
1,101 Views
Last Modified: 2008-03-10
I need to be able to print out multiple e-mails (which have multiple attachments of various types) in consequitive order out of Outlook 2003.
i.e. (1) E-mail no.1 (2) attachment no.1(word) to e-mail no.1 (3) attachment no.2(excel) to e-mail no.1 (4) E-mail no.2 (5) attachment no.1(pdf) to e-mail no.3 (6) attachment no.2(bmp) to e-mail no.2

Any ideas? Thanks.
0
Comment
Question by:jrctl
[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
  • 7
  • 3
12 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 16971153
Hi jrctl,

I can modify the code from this question (http://www.experts-exchange.com/Applications/MS_Office/Outlook/Q_21473712.html) to do this.  Is that what you're looking for?

Cheers!
0
 

Author Comment

by:jrctl
ID: 17001229
Hi again.

Hmmm maybe. I have a viewer that we possibly could use "C:\Program Files\Interwoven\WorkSite\view32.exe" that allows us to to view doc types. The problem with this app is that each document needs to be active in it in order to print out. i.e. you cannot select a range of documents and print the whole range.

Thanks.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 17004750
Let me know how you want to proceed and we'll take it from there.
0
Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
LVL 76

Expert Comment

by:David Lee
ID: 17065927
Hi, jrctl.

Any progress?
0
 

Author Comment

by:jrctl
ID: 17147635
No, not as yet. I don't seem to be getting anywhere. The problem is if we set the viewer to be the deafult application it still doesn't get around the printing in order issue. We could try the viewer but I think that it will only solve one of the issues.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 17147938
What about modifying the code to the question I linked to?
0
 

Author Comment

by:jrctl
ID: 17152607
That was my original question as well! Yes, this could work but if only you can ensure the timing of the file openings. As it stands, your script converts all HTML e-mails to rich text and then prints of the e-mails with their linked attachments - which is great. The problem with this, however, is that there does not seem to be any mechanism to ensure that all attachments to   e-mail no.1 are printed out in order before e-mail no. 2 and it's attachments are printed out. If you can solve this then great!!!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 17152701
I pretty sure I can make it work that way.  I'll test to make sure and get back to you.
0
 
LVL 76

Accepted Solution

by:
David Lee earned 2000 total points
ID: 17166068
I had a second look at the code from the other question and it looks to me like it will do what you want with minor modification.  The code I posted prints the open message and all attachments, so we need a modification that prints all selected messages, not just the open message.  The other issue is printing everything in sequence.  The messages will be handled in sequence and so will the attachments, but there is one factor I can't control.  Let's say a message has two attachments.  Attachment A is a Word document that's 20 pages long.  Attachment B is a small text file.  The code runs and prints the message then fires the command to print the Word document.  Word takes a moment to load and because the file is 20 pages long it's going to take several seconds to print.  In the meantime the code has moved along to the next attachment, the small text file, and ordered it to print.  The text file is probably going to appear before the Word document has finished.  I don't see any way to get around that.  There is no "tell an attachment to print and wait for it to finish before moving on" command.  I could through a Sleep command in to pause code execution immediately after the print, but that's not a good solution.  A large or complex document might take longer that then length of time I tell the code to sleep for, in which case we're back to having a problem, and items that print quickly will waste time while the code sleeps before printing the next item.  The only other approach would be to write a routine that would watch the queue of the printer the jobs are going to and watch for each one to finish before printing the next one.  That's possible, but it's certainly more complex and therefore more prone to problems.  Another alternative would be to pop up a dialog-box saying that attachment X has been sent to the printer and have you click a button to move on to the next item.  I expect that's not a good option.

Here's the modified code for printing all selected messages and their attachments.  Let me know how you'd like to proceed and we'll take it from there.

Sub PrintMessageAndAttachments()
    Dim objItem As Object, _
        objFile As Object, _
        strTempFolderPath As String, _
        strFilename As String, _
        objShellApp As Object, _
        objFolder As Object
    'Change the path on the next line to one that can hold temp files
    strTempFolderPath = "C:\eeTesting\Temp\"
    Set objShellApp = CreateObject("Shell.Application")
    Set objFolder = objShellApp.NameSpace(strTempFolderPath)
    For Each objItem In Application.ActiveExplorer.Selection
        If objItem.Class = olMail Then
            objItem.PrintOut
            For Each objFile In objItem.Attachments
                strFilename = strTempFolderPath & objFile.FileName
                objFile.SaveAsFile strFilename
                objFolder.ParseName(objFile.FileName).InvokeVerb ("&Print")
            Next
        End If
    Next
    Set objFile = Nothing
    Set objItem = Nothing
    Set objFolder = Nothing
    Set objShellApp = Nothing
End Sub
0
 
LVL 76

Expert Comment

by:David Lee
ID: 17220747
Any update, jrctl?
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Read this checklist to learn more about the 15 things you should never include in an email signature.
This article will help to fix the below error for MS Exchange server 2010 I. Out Of office not working II. Certificate error "name on the security certificate is invalid or does not match the name of the site" III. Make Internal URLs and External…
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

730 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