Solved

set up print margin

Posted on 2002-07-29
7
161 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

 
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

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

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bit defender blocks good applications 2 101
Hide vba in gp 7 106
Export Data to Different .csv Files 26 115
Error with a code discussed on this page 5 33
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…

830 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