Link to home
Start Free TrialLog in
Avatar of Robert Berke
Robert BerkeFlag 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
Avatar of Robert Berke
Robert Berke
Flag of United States of America image

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
Avatar of Robert Berke
Robert Berke
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial