Solved

set up print margin

Posted on 2002-07-29
7
158 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
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…
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…

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now