Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

set up print margin

Posted on 2002-07-29
7
Medium Priority
?
164 Views
Last Modified: 2010-05-01
if i use printer.endoc it will go several rows then stop i want to
go only one row and stop the doc and continuing next page
0
Comment
Question by:prasadharischandra
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 5

Expert Comment

by:jayeshshah
ID: 7185581
Try using the NewPage function of the Printer object.
0
 
LVL 4

Expert Comment

by:mcoop
ID: 7186596
i.e.

printer.print "page 1 line1"
printer.print "page 1 line2"

printer.newpage

printer.print "page 2 line1"
printer.print "page 2 line2"

printer.enddoc

0
 

Author Comment

by:prasadharischandra
ID: 7187385
mcoop,i want to not like that
ex:
i have one command button if i click one time then print
. again i preess command button again print.
at this two pages gap should be 1cm how to do that
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 4

Accepted Solution

by:
mcoop earned 100 total points
ID: 7187475
PASTE this into a text file, and save as Form1.frm
Open a porject with this form - and run !
' ------------------- START CUT HERE ------------------
VERSION 5.00
Begin VB.Form Form1
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Printer margin demo"
   ClientHeight    =   1065
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4800
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1065
   ScaleWidth      =   4800
   ShowInTaskbar   =   0   'False
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command3
      Caption         =   "Command1"
      Height          =   375
      Left            =   3600
      TabIndex        =   2
      Top             =   120
      Width           =   1095
   End
   Begin VB.CommandButton Command2
      Caption         =   "Command1"
      Height          =   375
      Left            =   120
      TabIndex        =   1
      Top             =   600
      Width           =   3375
   End
   Begin VB.CommandButton Command1
      Caption         =   "Command1"
      Height          =   375
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   3375
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Const topMarginMM = 20 ' first row prints 20mm from top of page
Const botMarginMM = 20 ' first row prints 20mm from top of page
Const rowHeight = 10 ' vertical separation between rows

Dim rowCount As Integer

Private Sub Command1_Click()
 
  If Printer.CurrentY > Printer.ScaleHeight - botMarginMM Then ' throw a new page
    Printer.NewPage
    rowCount = 0
  End If
 
  Printer.CurrentX = 10 ' left margin
  Printer.CurrentY = topMarginMM + (rowHeight * rowCount)
  Printer.Print "Row "; rowCount
 
  rowCount = rowCount + 1 ' increment to next row
  Command1.Caption = "Print page:" & Printer.Page & "  row:" & rowCount
 
End Sub

Private Sub Command2_Click()
  Printer.EndDoc
End Sub

Private Sub Command3_Click()
  For x = 1 To 20
    Command1_Click
  Next
End Sub

Private Sub Form_Load()
  Command1.Caption = "Print page:" & Printer.Page & "  row:" & rowCount
  Command2.Caption = "End doc"
  Command3.Caption = "20 rows"
 
  MsgBox "This assumes and prints to the default printer", vbOKOnly
 
  Printer.ScaleMode = vbMillimeters
  rowCount = 0
End Sub

' good luck !
0
 
LVL 4

Expert Comment

by:mcoop
ID: 7187493
BTW This is good value for 25 points !
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 8049055
Hi prasadharischandra,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept mcoop's comment(s) as an answer.

prasadharischandra, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 

Expert Comment

by:SpideyMod
ID: 8095841
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

722 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