Is there any way to insert a page break in plain .txt file from within VB6 ?

Posted on 2003-12-03
Last Modified: 2013-11-22
Thank You
Question by:AlexF777
  • 2
  • 2
  • 2
  • +3

Expert Comment

ID: 9869339
use the ForcePageBreak Property. i.e.

object.ForcePageBreak = integer

The settings for integer are:

Constant Value Description
rptPageBreakNone 0 (Default) No page breaks occur.
rptPageBreakBefore 1 The page break occurs before the current section.
rptPageBreakAfter 2 The page break occurs after the current section.
rptPageBreakBeforeAndAfter 3 Page breaks occur both before and after the current section
LVL 26

Expert Comment

ID: 9869347

LVL 42

Expert Comment

ID: 9869365

You can insert chr(11) which is the ascii standard "form feed" character; however, whether this is handled as a page break depends on which application you use to display the .txt file...
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

LVL 96

Accepted Solution

Bob Learned earned 175 total points
ID: 9869403
If you are going to open the text file in a program like Word, something like this will work:

   Open "c:\temp\test.txt" For Output As #1
   Print #1, "This is a test" & Chr$(12)
   Print #1, "This line is on the next page"
   Close #1

   Chr$(12) is the page feed character.
LVL 26

Expert Comment

ID: 9869488
That may not be recognized by the printer

LVL 42

Assisted Solution

frodoman earned 75 total points
ID: 9869508
TheLearnedOne is right - the page feed character is ascii 12 not 11.
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 175 total points
ID: 9869529
Generally speaking, Ascii(12) is the universal character for page feed.  It may not work in 100% of the cases, but it was true from back in the days when I used dot matrix printers, and it should still be true with other printer types.

Expert Comment

ID: 9878459
How about vbCR & vbLF, LF being line feed.

Expert Comment

ID: 15070525
vbFormFeed works too if you don't like remembering ASCII.

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Modifying Conditional Format from VBA code 3 59
Added a column screws up code 5 63
CheckListBox usage 3 71
I want to use librsync in my Delphi backup application. 3 58
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

809 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