Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Print Text to file in UTF-8 jakeatkins via OfficeKB.com Excel Programming 0 June 16th 09 08:38 PM
Print / Write to text file and usage of buttons [email protected] Excel Programming 1 March 2nd 07 02:09 PM
How do I print from a file created from sending a print to a file Ted Johnston Excel Discussion (Misc queries) 1 February 23rd 06 03:10 AM
Print content of cells to a text file loopoo[_2_] Excel Programming 2 November 17th 05 04:29 PM
How to print current data and time to text file Dayanand Excel Programming 2 May 31st 04 10:50 AM


All times are GMT +1. The time now is 07:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"