CreateTextFile method - Pagebreaks in the Text file

M

Murthy

I am creating a text file using the following code:

Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateTextFile(FilePath & NameOfFile, True)

Now, in the new text file created, I want to insert page breaks.

What is the code to be written to have page breaks in the text file created?

- Murthy
 
J

Joel

It is ASCiII code SOH (Start of Header) which is CHR(1).

So either
a.write chr(1)

or

a.writeline chr(1)
 
M

Murthy

Thanks.

Yes, chr(1) is writing something to the text file, but it really didn't
force a page break on a laser printer.

Still, I will test it on a line printer and get back.

Thanks for your help.
 
D

Dave Peterson

I thought formfeed was chr(12) (hex 0C).

I know that this worked on my old dot matrix printer from years ago--not sure if
it'll work with the OP's printer.
 
J

Joel

You need to check the manual for your printer to find out what control
characters or escape sequence will produce a page break. Any of these
sequences can be made using a combination of chr() statements

PageBreak = chr(13) & chr(10) & ..............
 
M

Murthy

Thanks Joel and Dave.

Finally Chr(12) has worked for my printer.

My sincere thanks to both of you again.

- Murthy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top