Avatar of Robert Berke
Robert Berke
Flag for United States of America asked on

vba .printout method does not print embedded Jpg.

I have an Outlook Vba macro that is suppose to print selected emails to a pdf file.
The following code does not work on windows XP.  (it works on Windows 7)
sub PrintSelectedEmails
For Each item In ActiveExplorer.Selection
item.printout
Next
end sub

Open in new window


The email printout does not show the embedded jpg. Instead, it shows a Red Box.
If the user prints the item manually, it works fine.

Or, if the user opens a single email, the following code works fine

ActiveInspector.CurrentItem.printout

Outlook 2003 is being used on all computers. Also, I emptied the OutlookSecureTempFolder
and turned of the "send copy of the reference". Neither fix helped.  Only problem is on the printout, not anywhere else.
rberke
outbind---15-00000000F31E38A3B6D.pdf
outbind---14-00000000F31E38A3B6D.pdf
t1--1-.msg
OutlookExchangeMicrosoft Excel

Avatar of undefined
Last Comment
Robert Berke

8/22/2022 - Mon
Robert Berke

ASKER
On XP, if the item is being displayed, the printout method works, otherwise it does not.

So, I thought the following would work.  But, it turns out the item.printout request is "Queued" and does not start executing until after the vba macro exits.   So, by the time execution starts the items are no longer displayed.

For Each item In ActiveExplorer.Selection
   item.display
   sleep 3000
   item.printout
   item.close (olDiscard)
Next

One possible solution is to move the item.close into a different vba subroutine which the user calls AFTER the printouts are done. But, this macro is supposed to be able to print dozens of emails in one pass.  So, that is not an acceptable solution.

I'll leave this open, but I don't expect anybody is going to have a good solution.
ASKER CERTIFIED SOLUTION
Robert Berke

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes