Solved

set up print margin

Posted on 2002-07-29
7
160 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
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 4

Accepted Solution

by:
mcoop earned 25 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

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