Printing an image (tiff) file

gagon

New Member
Joined
Oct 15, 2003
Messages
3
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.
:-?
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
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".
 
Upvote 0
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.
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,223,935
Messages
6,175,496
Members
452,649
Latest member
mr_bhavesh

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top