Results 1 to 2 of 2

Thread: Automatic Printing of Tiffs In Outlook 2007 using Rules and Script

  1. #1
    VBAX Newbie
    Jun 2008

    Automatic Printing of Tiffs In Outlook 2007 using Rules and Script

    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:
    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
    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&
    Set att = Nothing
    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?

    FYI - if you enclose your code in [vba][/vba] tags then it will be formatted as per the VBIDE to improve readability. Also, please do not post in all caps or all bold.

  2. #2
    Yup indeed, I agree that using a fine Tiff processing tool to deal with the related Tiff manipulating projects can be very convenient. I will try your sharing later. Thanks.
    Best Regards,

    I am testing about image resizers to resize images, any ideas?

    Next Tomorrow is Another Day.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts