Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print Text File
Hi I have created a text file in vba and I need to print the file without the
user opening it first, I have tried using excel import and print this works but cuts some of the text off. I was wondering if it can be printed by send the text file to the printer??. Any help would be much appreciated. Charles |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Print Text File
Charles,
The sub below will basically cause the text file to be printed in the same fashion as if you right clicked it in Windows Explorer and chose 'Print' from the context menu (or sent it into the printer). On my system, it prints with Notepad. '------------------------------------ Sub ShellPrint() Dim strMyFile As String strMyFile = "C:\Test\myList.txt" Set myShell = CreateObject("Shell.Application") myShell.ShellExecute strMyFile, , , "print", 0 Set myShell = Nothing End Sub '---------------------------------- Steve Yandl '"vqthomf" wrote in message ... Hi I have created a text file in vba and I need to print the file without the user opening it first, I have tried using excel import and print this works but cuts some of the text off. I was wondering if it can be printed by send the text file to the printer??. Any help would be much appreciated. Charles |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro to Print Text to file in UTF-8 | Excel Programming | |||
Print / Write to text file and usage of buttons | Excel Programming | |||
How do I print from a file created from sending a print to a file | Excel Discussion (Misc queries) | |||
Print content of cells to a text file | Excel Programming | |||
How to print current data and time to text file | Excel Programming |