setting font style for text output

I am opening a text output file as follows:

Open "filename" For Output As #2

This is a notepad file. I now want to set the font style to "Courier". How ? The reason for this is the equal character spacing of the Courier font for columnar spacing.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Notepad does not understand any formatting.
You would be better with the RTF (Rich Text Format)
using a RichTextBox control.


If you open the file as output, it means that you are writing to it. Then, you _can't_ set the font of the file: the file is only a set of characters!

The font that you see is the one you set up in your editor (e.g. Notepad).

If you mean that you want to open the file for _input_ and show it in your application, then simply set the "Font" property of the textbox, richtextbox, or whatever control you need.

Let me know more details if you need more info
The only other choice is to output into a file with formatting that some application will understand.  Notepad does not understand formatting, but others do, such as a browsers, so you could write this:

strOutputText = txtOutputInfo.Text ' transfer message here

Open "filename.htm" For Output As #2

print #2, "<HTML>"
print #2, "<BODY>"
print #2, "<FONT FACE='Courier New'>"; strOutputText; "</FONT>"
print #2, "</BODY>"
print #2, "</HTML>"
close #2

Note that I used Courier New, which is a better choice than Courier.
Also note that I saved this as an html file (in the open statement) so that you can just double-click it and see it in your browser.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Richie_SimonettiIT OperationsCommented:
That's not a "notepad file". It is just plain text file that you COULD open with notepad.
If you need to change the font in Notepad, you have to change to the registry, open the file with Notepad and change to the registry again.
The key is located at:

The steps should be:
Save the current value
change it
open the file
restore the original value:
To change values to registry, see this link:
I'm not positive, but I think the Notepad font change is only available starting with Windows 2000.  If you have an earlier system, I'm pretty sure you're stuck with Courier New anyway.

Another possibility is to simply write yourself a simple app that "simulates" notepad.  Just add a textbox to a form, maximize it in the Resize event procedure, and add a menu with a few commands to load, save, cut/copy/paste.

Yet another possibility is to grab an older version of Notepad from, say Win95, rename it to something like Notepad95.exe and deliver that with your app and call it on demand.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gronAuthor Commented:
Sorry folks, the question was badly worded. After I create the output file, I then open it with a

Shell "notepad filename", 3

It's at this point that I would have wished to set the fontname.
rspahitz: yes, you're right, I'm working with W2K. W98 also has a font name option under "Edit - Set Font", but I don't know about the others.
Ritchie: Good idea, but it's in a different registry location on W98, and maybe others OS.
So I'm going with the flow here, and re-designing the app. Thanks all.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.

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.