I have an issue where we use Outlook as a users incoming Fax machine. Basically a fax comes in and we set a rule so that it is moved to a folder (within Outlook), also copied to a file on their C Drive through some basic VBA coding and automatically prints out the cover sheet as well as the attachments. The fax comes in as a Tiff (opening in Microsoft Document Imaging) and works fine in XP and Office 2003 as it prints out all the time without any prompts from the user.

However in Vista and Office 2007 it seems to have changed. I can get the file opening up in Microsoft Document Imaging (adding it in as it is not a default program) and printing when double clicking into it but when i run the rule over it, it works correctly until it needs to print the attachment (prints the email cover sheet fine) and it opens it up in Print Pictures and automatically asks you to choose which format you want to print to which sort of defeats the object. Has anybody got any idea how I can get it to print out without going to the Print Pictures screen?

Here is my code:
[VBA]
Private Declare Function ShellExecute Lib "shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long


Sub Saveprint()
Dim theSel As Outlook.Selection
Dim MyTime, strFilename
Set theSel = Application.ActiveExplorer.Selection
If theSel.Count = 0 Then
Exit Sub
Else
For Each itm In theSel
Set myAttachments = itm.Attachments
For Each att In myAttachments
MyTime = Time
MyTime = Replace(MyTime, ":", " ")
strFilename = "C:\Dim\" & MyTime & " " & att.DisplayName
att.SaveAsFile strFilename
ShellExecute 0&, "print", strFilename, 0&, 0&, 0&
Next
Set att = Nothing
'itm.Close
Next
Set itm = Nothing
Set theSel = Nothing
End If
End Sub[/VBA]

If i run the macro it does everything but still brings up the annoying screen!!!

Anyone have any ideas?


[uvba].[/uvba] Also, please do not post in all caps or all bold.
Thanks,
Oorang