Printing messages with .tif attachments from Public Folder

G

gantzt

One group of users have XP Pro SP2 and OL2002 SP3. Users select rang
of plain txt messages in a public folder which all have attached .ti
fax files and then click on Print button in Public Folder windo
(without opening messages first). For some users, this will prin
emails and attachments directly using Microsoft Office Documen
Imaging (MSPVIEW.EXE), which is what is set as default fil
association for .tif files. That is great

But for another group of users with same OS and OL and same fil
association for .tif files to use MODI, when they select the message
and click on Print, it brings up window asking if you want to open th
attachment and in the meantime, it is printing out only the email wit
the icon representing the attachment, but not the attachment. If yo
click on OK to open the attachment, it opens up Windows Picture an
Fax Viewer (rundll32.exe C:\WINDOWS\system32\shimgvw.dll) and whe
you click on Print in that app, you have to go through the multipl
steps of the Photo Printing Wizard. But the users just want t
highlight the range of emails in the public folder and click on prin
and it prints the emails and attachments

For those problem users, if they open one of those emails in th
public folder individually and then click on Print, surprisingly, i
will correctly use MODI as it should to print the email and it'
attachment without having to go through any extra steps like you hav
to do with WPFV. I can't figure out why it is using WPFV in on
situation and MODI in the other since the file association for .ti
is to MODI, not WPFV

Then we have a third group of users who have XP Pro SP2 and OL2003 SP
who do not have MODI on their machines at all! MSPVIEW.EXE doesn'
exist on their machines. They only have WPFV. I'm trying to figur
out how I can get MODI back onto their machines

My goal is to get all users set to that they can go into Publi
Folders, select a range of pain txt emails with .tif attachments an
just click on the Print button and all the emails and thei
attachments will print out in one step, as it is for one group of m
users

Does anyone have any ideas

Thanks

To
 
G

gantzt

I hadn't had any responses back to my query, but fortunately, I wa
finally able to resolve it on my own

For our Outlook XP (2002) users who have this problem and have no
been upgraded to office 2003 yet, I created a new macro in OL tha
will open the selected emails in the OL window using the Image Make
Viewer (SHIP32.EXE) app and print all the .tif files attached t
those emails at one go

The VB script I put into the macro is

Private Const SW_NORMAL =
Private Declare Function ShellExecute Lib "shell32.dll" Alia
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String
ByVal lpFile As String, ByVal lpParameters As String, ByVa
lpDirectory As String, ByVal nShowCmd As Long) As Lon
Sub PrintTiffAttachments(
Dim ns As NameSpac
Dim ib As MAPIFolde
Dim msg As MailIte
Dim att As Attachmen
Dim tiffilename As Strin

Set ns = ThisOutlookSession.Sessio
Set ib = ns.GetDefaultFolder(olFolderInbox

'MsgBox (ib.Application.ActiveExplorer.Selection.Class

For Each msg In ib.Application.ActiveExplorer.Selectio
With ms
For Each att In .Attachment
tiffilename = "C:\TEMP\" & att.FileNam
att.SaveAsFile (tiffilename
ShellExecute hwnd, "Open", "C:\UTIL\SHIP32.EXE", "/p
& tiffilename, vbNullString, SW_NORMA
Next 'at
End Wit
Next 'ms
End Su

The only thing you'd need to chane in the code above is the path t
where the Image Maker Viewer is on the machine or a shared networ
drive. Above, I have it at C:\UTIL\SHIP32.EXE. I'm not sure if i
will work just as well if you use another program that can open .to
files or not since I haven't tested it with other .tif capable apps

Then for our Office 2003 OL users, I'm going to Add/Remove Programs C
into the properties for MS OFfice 2003 and adding the Microsoft Offic
Document Imaging component (which is not being installed in our Of
2003 deployment up until now), and then changing the users registr
by changing the REG_EXPAND_SZ default value i
HKEY_CLASSES_ROOTS\SystemFileAssociations\image\shell\print\comman
from
Windows Fax and Print Viewer "rundll32.ex
%SystemRoot%\system32\shimgvw.dll,ImageView_Fullscreen %1
to the Microsoft Document Imaging app with a "/p" before the last %
to allow it to print from the Print button in the folder window
i.e.
"%SystemRoot%\Program Files\Common Files\Microsof
Shared\MODI\11.0\MSPVIEW.EXE" /p "%1

The first time you print, will come up asking if you want to open th
attachment, but there is a check box you can uncheck that says not t
ask you each time about it

I'm hoping to get the above for 2003 users put into our company'
Office 2003 install package by default so I won't have to do i
manually
 
M

MAR

When I try to paste this code into a new module I receive a messag
"Only comments can appear after End Sub or End Module..." I trie
putting 'End Function" after each Private statement to no avail...

BACKGROUND: I am using Outlook 2002, opening the Visual Basic windo
and pasting the code...

What am I missing


-
MA
 
G

gantzt

Hmm. I'm not sure what is causing your problem. I have never gotte
that error when I paste the code below into a new module window i
Visual Basic 6.3 that we have on our machines. Here is what I do ste
by step

1) Create macro in Outlook XP (2002) to print attachments
- Go into the Tools menu in Outlook and go down to Macro and the
inside that, choose "Macros…"
- In the Macros box that appears, in the Macro name box, type in th
name for the new macro, "PrintTiffAttachments" in this case and clic
on the Create button
- A Microsoft Visual Basic window will appear with a VbaProject.OTM
window open
- Copy in the code below

Private Const SW_NORMAL =
Private Declare Function ShellExecute Lib "shell32.dll" Alia
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String
ByVal lpFile As String, ByVal lpParameters As String, ByVa
lpDirectory As String, ByVal nShowCmd As Long) As Lon
Sub PrintTiffAttachments(
Dim ns As NameSpac
Dim ib As MAPIFolde
Dim msg As MailIte
Dim att As Attachmen
Dim tiffilename As Strin

Set ns = ThisOutlookSession.Sessio
Set ib = ns.GetDefaultFolder(olFolderInbox

'MsgBox (ib.Application.ActiveExplorer.Selection.Class

For Each msg In ib.Application.ActiveExplorer.Selectio
With ms
For Each att In .Attachment
tiffilename = "C:\TEMP\" & att.FileNam
att.SaveAsFile (tiffilename
ShellExecute hwnd, "Open", "C:\UTIL\SHIP32.EXE", "/p
& tiffilename, vbNullString, SW_NORMA
Next 'at
End Wit
Next 'ms
End Su

((the first part of the code up until just before the first Sub line

Private Const SW_NORMAL =
Private Declare Function ShellExecute Lib "shell32.dll" Alia
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String
ByVal lpFile As String, ByVal lpParameters As String, ByVa
lpDirectory As String, ByVal nShowCmd As Long) As Lon

are Delarations, so there should be a line between that part and th
reset of it starting from the first Sub line, and if you click o
anything above that line, at the top right of the module window, i
will have a pop-down box that says "(Declarations)". If you click o
any of the code below that line, at the top right, in the pop dow
box, it should change from Declarations to "PrintTiffAttachments".
wondoer if you have those declaration lines down in the body of th
script maybe

If the body of the script starts with that "Su
PrintTiffAttachments()" line, and then at the bottom ends with th
"End Sub", and you do not have any Sub or end Sub lines anywhere els
in the script, then it is strange if you get an error that says ""Onl
comments can appear after End Sub or End Module..." "))

- Then click on the File menu and choose "Save VbaProject.OTM"

2) Adding the macro to Outloo
- In Outlook, go into the View menu down to Toolbars and choos
"Customize…"
- Click on the Commands tab and the in the Categories window, choos
Macros. You should then see in the right-hand side window, th
PrintTiffAttachments macro.
- Grab the icon for that macro and drag it up to the toolbar and dro
it

- Then you should see that macro as a choice on your toolbar

To use it, select the files that have the attachments and then clic
on this PrintTiffAttachments macro button and as long as the attache
.tif file has no spaces in the name, which it should not have if i
came through the fax system, it should print out all the pages of th
attachments of each file

I hope this helps you, but I realize that I haven't told you anythin
very different than I had in my previous post
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top