Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Printing an image (tiff) file

  1. #1
    New Member
    Join Date
    Oct 2003
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Printing an image (tiff) file

    Please help! I am using OCR software to convert .tiff files to .xls files. In Excel I wrote a macro that executes upon encountering certain errors however I can't figure out the code I need to make Excel print the original .tiff file even though they have the same filename just different file extentions (tiff vs xls). I have all the necessary code except how to call the original .tiff file and print it to a printer.
    Thanks in advance for the help.

  2. #2
    MrExcel MVP Damon Ostrander's Avatar
    Join Date
    Feb 2002
    Location
    Denver, Colorado USA
    Posts
    4,239
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Printing an image (tiff) file

    Hi gagon,

    In order to print a tiff file you must use a program that is capable of printing it. Then you can use the VBA SHELL function to run the print as a shell command. Here's an example of using SHELL to print a tiff file using the Microsoft PhotoEditor that is included with MS Office"

    Shell """C:\Program Files\Common Files\Microsoft Shared\PhotoEd\photoed.exe"" -p h:\misc\MyPicture.tif"

    Note that I included the complete path to the photoeditor application, and also the complete path to the MyPicture.tif file (not necessary if the file is in the current directory). I used double quotes in the photoed path because the path contained a space.

    This SHELL command can be embedded in an Excel VBA macro.

    It is also possible to print tif files from other applications using DDE or Automation. The Automation approach requires an OLE-compliant application, but also provides much more capability--for example, the ability to size and place the picture on the page, adjust the picture's contrast or brightness, etc. If you are unfamiliar with Automation you can read up on Automation in the VBA helps of any MS Office application under the topic "Understanding Automation".
    Keep Excelling.

    Damon

    VBAexpert Excel Consulting
    LinkedIn Profile http://www.linkedin.com/pub/damon-ostrander/7/79/a93
    AllExperts Profile http://www.allexperts.com/ep/1059-30...-Ostrander.htm

  3. #3
    New Member
    Join Date
    Oct 2003
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Printing an image (tiff) file

    Thanks for the tip that helps. The current problem is I am using the following code and am getting a "type mismatch error."

    Sub printTIFFfile()

    filename = ActiveCell.Text

    Shell """c:\program files\common files\microsoft shared\photoed.exe""-p s:\FAXD_VCHRS" \ filename

    End Sub

    What do I need to do differently so that it prints the file identified by the filename variable.

    Thanks for the help I really appreciate it.

  4. #4
    MrExcel MVP Damon Ostrander's Avatar
    Join Date
    Feb 2002
    Location
    Denver, Colorado USA
    Posts
    4,239
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Printing an image (tiff) file

    Hi again gagon,

    I believe that what you want is the following:

    Shell """c:\program files\common files\microsoft shared\photoed.exe""-p s:\FAXD_VCHRS\" & filename
    Keep Excelling.

    Damon

    VBAexpert Excel Consulting
    LinkedIn Profile http://www.linkedin.com/pub/damon-ostrander/7/79/a93
    AllExperts Profile http://www.allexperts.com/ep/1059-30...-Ostrander.htm

  5. #5
    New Member
    Join Date
    Jun 2013
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Printing an image (tiff) file

    if you want to print a tiff files vb.net, you need a pdf application which can connet to the printer. here are some codes you might want to see, i think it is really useful to you.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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