send escape sequences to the printer from windows95

Posted on 1999-07-28
Medium Priority
Last Modified: 2010-04-30
I have a simm loaded with forms that i insert in the memory banks
of an hp 4 plus printer, To print this forms  from ms-dos and windows 3.x a send escape sequences (hp pcl commands)using the chr(27)(escape character) from a program that i made in visual basic.
My problem is that when i try to do the same operation from windows 95 using visual basic 5.0 i can't. same people tell me that windows 95 don't recognize the chr(27), i try the passtrogh
but don't work.
If you can help, please send me and email
Question by:pelon
1 Comment

Accepted Solution

kfrick earned 150 total points
ID: 1527914
I have found that you can write the entire printer output to a file, then use the SHELL command to fire the DOS "PRINT" command.....

      Sub TestPrint()
        Open "C:\Test.txt" for Output As #1
        Print #1, "This is plain Text"
        Print #1, Chr$(27);Chr$(whatever is Bold);"This is Bold Text"
        Close #1
        Shell "PRINT C:\TEST.TXT"
      End Sub

Remember that the Print# statement automatically adds a  Carriage Return Chr$(13) to the line. You may also have to add a Line Feed Chr$(10), depending on your printer. You can also suppres the automatic CR by ending the statement with a semi-colon, like so....
        Print #1, "This is the first line....";
        Print #1, "And so is this!"
This feature can be usefull to mix print styles on the same line....

Hope this helps!

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As a person who answers a lot of questions, I often see code that could be simplified, made easier to read, and perhaps most importantly made easier to maintain if the code was modified to use the Select Case statement. This article explains how to…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question