Solved

set up print margin

Posted on 2002-07-29
7
159 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…

911 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

24 Experts available now in Live!

Get 1:1 Help Now