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.
:confused:
 

Some videos you may like

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Damon Ostrander

MrExcel MVP
Joined
Feb 17, 2002
Messages
4,239
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".
 

gagon

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

Damon Ostrander

MrExcel MVP
Joined
Feb 17, 2002
Messages
4,239
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
 

Watch MrExcel Video

Forum statistics

Threads
1,127,861
Messages
5,627,314
Members
416,239
Latest member
Counselor85027

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
Top