Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dear Tom:
The lpt1 is a problem, since I am using a network printer. I got some code a while back that allowed me to open and view a text file. I was hoping for a similar tip that would allow me to print the text file. I realize that I may have tapped you out on this. Should I repost and see if someone else can provide code to do what I want? I get the impression that once a post has a reply, then other MVPs assume it has been handled. Thus, do I need to repost to get others to look at this as well? Thanks. -- Dr. Doug Pruiett Good News Jail & Prison Ministry www.goodnewsjail.org "Tom Ogilvy" wrote: If I wanted to do it from DOS/Command window I would do copy "C:\MyFile\Test.txt" Lpt1 perhaps you can get the shell command to support something like that. I haven't tried it. -- Regards, Tom Ogilvy "Chaplain Doug" wrote: Dear Tom: First, I thank you for taking the time to try to help me. The code you suggest here is the same as I already have. It does not give reliable results. For instance when I set my default to one network printer it prints with super small top, left, right, and bottom margins. When I set my default to another network printer, the printer says I need to load COM10 envelopes. When I set my default to my desktop printer, it does not print at all. What I would really like to do is save the text from the control into a ".txt" file (this I know how to do) and then print this file. How from Excel VBA can I print an existing file? Thanks for the help and God bless. -- Dr. Doug Pruiett Good News Jail & Prison Ministry www.goodnewsjail.org "Tom Ogilvy" wrote: Test this chaplain doug Sub abc() Dim PrinterName As String, I As Integer s = "0123456789012345678901234567890123456789" I = InStr(Application.ActivePrinter, " on ") PrinterName = Mid(Application.ActivePrinter, 1, I - 1) Open PrinterName For Output As #1 Print #1, s & s Close #1 End Sub this went all the way across the paper - if it does it for you, you may have to take out the CHR(10)'s in your text box and place them in more appropriate places in your text string. -- Regards, Tom Ogilvy "Chaplain Doug" wrote: Excel 2003. FIRST, I want to just be able to print (to my default printer) the contents of a text control on a user form. I was given the following code, but the printout is funky (margins are super narrow). Dim PrinterName As String, I As Integer I = InStr(Application.ActivePrinter, " on ") PrinterName = Mid(Application.ActivePrinter, 1, I - 1) Open PrinterName For Output As #1 Print #1, ProcessStatus.ProcStat.Text Close #1 IS THERE A BETTER WAY TO ACCOMPLISH THIS? SECOND, How does one print out an external file from Excel VBA code. Suppose for instance that I want to print out file "Test.txt." How would I program that? Thanks for the help and God bless. -- Dr. Doug Pruiett Good News Jail & Prison Ministry www.goodnewsjail.org |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ADDING A PRINT CONTROL BUTTON | Excel Worksheet Functions | |||
Control item PRINT in menu FILE of Excel | Excel Discussion (Misc queries) | |||
How do I print from a file created from sending a print to a file | Excel Discussion (Misc queries) | |||
Disable printPreview's Print Control! is it possible???? | Excel Programming | |||
Print Control in Word/Excel | Excel Programming |