PC Review


Reply
Thread Tools Rate Thread

CreateTextFile method - Pagebreaks in the Text file

 
 
Murthy
Guest
Posts: n/a
 
      1st Oct 2008
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


 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      1st Oct 2008
It is ASCiII code SOH (Start of Header) which is CHR(1).

So either
a.write chr(1)

or

a.writeline chr(1)

"Murthy" wrote:

> 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
>
>

 
Reply With Quote
 
Murthy
Guest
Posts: n/a
 
      1st Oct 2008
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.



"Joel" wrote:

> It is ASCiII code SOH (Start of Header) which is CHR(1).
>
> So either
> a.write chr(1)
>
> or
>
> a.writeline chr(1)
>
> "Murthy" wrote:
>
> > 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
> >
> >

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      1st Oct 2008
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.

Joel wrote:
>
> It is ASCiII code SOH (Start of Header) which is CHR(1).
>
> So either
> a.write chr(1)
>
> or
>
> a.writeline chr(1)
>
> "Murthy" wrote:
>
> > 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
> >
> >


--

Dave Peterson
 
Reply With Quote
 
Joel
Guest
Posts: n/a
 
      1st Oct 2008
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) & ..............

"Murthy" wrote:

> 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.
>
>
>
> "Joel" wrote:
>
> > It is ASCiII code SOH (Start of Header) which is CHR(1).
> >
> > So either
> > a.write chr(1)
> >
> > or
> >
> > a.writeline chr(1)
> >
> > "Murthy" wrote:
> >
> > > 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
> > >
> > >

 
Reply With Quote
 
Murthy
Guest
Posts: n/a
 
      3rd Oct 2008
Thanks Joel and Dave.

Finally Chr(12) has worked for my printer.

My sincere thanks to both of you again.

- Murthy

"Dave Peterson" wrote:

> 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.
>
> Joel wrote:
> >
> > It is ASCiII code SOH (Start of Header) which is CHR(1).
> >
> > So either
> > a.write chr(1)
> >
> > or
> >
> > a.writeline chr(1)
> >
> > "Murthy" wrote:
> >
> > > 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
> > >
> > >

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open tab text file method tony wong Microsoft Excel Programming 1 4th Aug 2007 11:48 AM
outputto method to delimited text file =?Utf-8?B?VmluY2U=?= Microsoft Access External Data 2 17th May 2005 03:38 AM
fastest method to load text file =?Utf-8?B?R2F1cmF2IC0gaHR0cDovL3d3dy5nYXVyYXZjcmVh Microsoft VB .NET 5 20th Apr 2005 12:10 PM
Reading text from file using ReadLine method =?Utf-8?B?Q0Q=?= Microsoft VB .NET 3 24th Nov 2004 08:20 AM
CreateTextFile not updating file Sean McPoland Microsoft Excel Programming 1 4th Feb 2004 10:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:46 AM.