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 |
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 |
All times are GMT +1. The time now is 08:52 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com