Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Printer Ejects Blank Page Before Printing Report?

I am using the Printer Object in VB6. When I go to print the report...a blank page is printed before the rest of the report. I simply want to print the report without that blank page. So, in the Procedure that Prints the page headers, I inserted a Printer.NewPage statement as the very first statement in the procedure. Unfortunately, it still prints a blank page. How can I eliminate the blank page printing?


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Printer Ejects Blank Page?
I'm trying to print a report using Printer object. Each time I run the report, a blank page ejects. It's a very simple routine. I have attached the code.



VB Code:
Private Sub PrintClientListing()    Dim loopCnt         As Integer        On Error GoTo ErrProc        Printer.Orientation = 2    PrintHdrs:    Printer.NewPage    Printer.CurrentY = 500    Printer.FontBold = True    Printer.FontSize = 11    Printer.Font = "Times New Roman"    Printer.Print Tab(5); Format(Date, "mm/dd/yyyy");        Printer.FontSize = 16    txtstring = "McKenna's Way Personal Training"    Printer.CurrentX = (Printer.ScaleWidth - Printer.TextWidth(txtstring)) / 2    Printer.Print txtstring;    Printer.FontSize = 11    Printer.Print Tab(153); Format(Time, "hh:mm:ss")        Printer.CurrentY = 1300    Printer.FontSize = 12    txtstring = "Client Listing"    Printer.CurrentX = (Printer.ScaleWidth - Printer.TextWidth(txtstring)) / 2    Printer.Print txtstring    Printer.Print        Printer.FontBold = True    Printer.FontSize = 11    Printer.Print Tab(6); "Client Name"; Tab(35); "Address"; Tab(75); "City, State, Zip"; Tab(107); "Phone"; Tab(127); "Email"    Printer.Print Tab(6); "---------------------------------------------------------------------------------------------------------" _                      ; "-------------------------------------------------------------------------------------------------"    Printer.FontBold = False    lineCnt = 6    PrintDetailLine:    Do Until loopCnt > 3        rsClient.Index = SortKey        rsClient.Seek ">", ""                If rsClient.EOF Then        Else            Do Until rsClient.EOF                If rsClient.EOF = True Then                    Exit Do                Else                    Printer.Print Tab(6); rsClient!cliLName & ", " & rsClient!cliFName; _                             Tab(35); rsClient!cliAddr1; _                             Tab(75); rsClient!cliCity & ", " & rsClient!cliState & " " & rsClient!cliZipCode; _                             Tab(107); rsClient!cliPhone; _                             Tab(127); rsClient!cliEmail                    If lineCnt > 58 Then                        GoTo PrintHdrs                    End If                    If rsClient!cliAddr2 > "" Then                        Printer.Print Tab(35); rsClient!cliAddr2                        If lineCnt > 58 Then                            GoTo PrintHdrs                        End If                    End If                    rsClient.MoveNext                End If            Loop            loopCnt = loopCnt + 1        End If    Loop    Printer.EndDoc        Exit Sub    ErrProc:    MsgBox Err & ": " & ErrorEnd Sub

Printer Ejects Long Paper After Printing......???
i m dealling with project printing wid dot matrix printer...............
everything went fine
-I m using rolled continuous paper
-when i print, it prints as i need
but the problem is that.......after printing it ejects paper very much
-As printing length is not definite as bill might be longer or shorter accordin to the transaction
-All i want is after printing my bill it shouldnt eject long paper
how should i do?


Sabin Kumar Chhetri

Edited by - saracjl on 6/12/2005 12:05:28 AM

Printing Using Rich-text Editor With Page Ejects In A Single Print Job
Hi everybody,
I have made a print utility using the Rich text editor control. The output to be printed is first displayed on a rich text editor control and on clicking the print command button, it is printed using the SelPrint method. To have page eject, I used the SelPrint method for every page. But the drawback of this method is that for every page a seperate print job is generated. Is there any way I can print all the pages in a single print job and also have page ejects between pages ?

[crystal Report] Avoid Printer From Ejecting Page After Printing A 3 Line Page
Im taking a printout in crystal report - but there are only 3 lines and after printing it goes to next page - but I dont want it to goto next page.
Instead I want it to continue the rest of the printing - which may be in some other report etc - to continue printing from where it left behind (maybe one or 2 lines break)
But after printing 3 lines it automatically ejects out the paper and goes to next page
How do I avoid this ?

Edit by johnminkjan: Topic Title


Edited by - johnminkjan on 9/7/2004 12:01:29 PM

Blank Page When Printing In CR 4.6 And CR 8.0
Anyone help me please.
When I'm trying to print a report in CR 8.0, it shows a blank page, or if I'm lucky, it shows only one line in the DETAILS section, when it should print at least 5 lines...

If i write
    Msgbox "Printing..."
    'And Then
    CR.Action = 1
It works OK in my Computer, but in other PCs it doesn't work every time

I was using CR 4.6 and it was working OK, but now I returned to it after uninstalling CR 8.0 and now it does the same...

If anyone can help me...
Thank you all.

Sorry for my bad English, I speak spanish.

Word Printing Blank Page
Hi people,

I'm trying to print an excel document and a word document that I create in my code. If I step through my code everything prints fine... if i let the code run though, the excel document prints as it's supposed to but the word document comes out blank (or in some cases with the letters 'IB' in the top left corner). This is my code to print:

VB Code:
oWord.Documents.Open "d:devsummary.doc"                oWord.Selection.Font.Name = "Arial"                oWord.Selection.Font.Size = 10                oWord.Selection.TypeText frmObject.txtInvestigationPlan.Text                                'save workbook                strNewFileName = "H:Summary_" & Replace(Replace(Now(), "/", ""), ":", "") & ".xls"                .ActiveWorkbook.SaveAs strNewFileName                 oWord.Documents(1).SaveAs Replace(strNewFileName, ".xls", ".doc")                 'Ask to print                If MsgBox("Report has been exported to:" & vbCrLf & strNewFileName & vbCrLf & _                            vbCrLf & "Do you want to print the report now?", vbYesNo, "Print") = vbYes Then                                        oExcel.ActiveWorkbook.PrintOut 1, 1                    DoEvents                    oWord.ActiveDocument.PrintOut                End If

Any ideas on this?

How Can I Stop Printing A Blank Page First?
Hi all,

The code below prints out the slected document as many times that I have selected from the list and does some replacing, all is well accept that it prints out a blank page before printing anything else out. How can I sort this problem out?



VB Code:
Private Sub Command2_Click()Dim i As IntegerSet objWordApp = CreateObject("Word.Application")objWordApp.Visible = FalseSet objDestDoc = objWordApp.Documents.Add For i = 0 To List1.ListCount - 1    If List1.Selected(i) Then        Set objWordDoc = objWordApp.Documents.Open(Text12.Text)        Set objWdRange = objWordDoc.Content        Set objDestRng = objDestDoc.Content        With objWdRange.Find            .ClearFormatting            .Replacement.ClearFormatting            .Text = "//1"            .Replacement.Text = List1.List(i)            .Execute Replace:=wdReplaceAll        End With        objWdRange.Copy        objDestRng.Collapse wdCollapseEnd        objDestRng.InsertBreak Type:=wdPageBreak        objDestRng.Paste        objWordDoc.Close SaveChanges:=False    End IfNextobjDestDoc.PrintOutobjDestDoc.Close SaveChanges:=FalseSet objDestDoc = NothingSet objWordDoc = NothingobjWordApp.QuitSet objWordApp = NothingEnd Sub

Printing A Blank Report With No Data, Just Report Format
I have a datareport designed in VB6 which is working fine with my data, however i am now trying to print out a blank report...for instance, in this case a blank invoice which would have all the correct layout and fields etc, just no data so it can be hand written after priting out.

I have tried sending a SQL string which i know will return no data but all i get when VB generates the report is a completely blank white sheet of paper.

Appreciate any assistance with this.

Thanks in advance

Khalid Rahaman

Access Report Giving Me A Blank Page After Every Gouping
I'm creating a report where I want to print out sales person detail info on a separate page for every sales person. I have a report header, page header, ccode header(sales person), detail, ccode footer, pager footer, and report footer.

For the ccode header property “force new page” I have it set to "before section". The report is printing a sales person per page but it is giving me a blank page between sales people.

How do I get rid of the blank page????????

Edited by - rickyc1 on 2/20/2002 7:30:50 AM

Printer's Printing An Extra Page
When I use this:

VB Code:
Form1.Line (0, 0)-(Form1.Width, Form1.Height), RGB(255, 0, 0), BF    Printer.Copies = 1    Printer.NewPage    BitBlt Printer.hdc, 0, 0, 200 * Screen.TwipsPerPixelX, 200 * Screen.TwipsPerPixelY, Form1.hdc, 0, 0, &HCC0020    Printer.EndDoc

The printer will print a blank page and then the page that I want, am I missing a step here?


Don't Eject Page After Printing In Printer
Hello All,
I am using VB6. I have module to print Labels on Dot-matrix printer in the user defined size.
say for eg a label with width 3 inch and height 1 inch. I am directly writing to the printer using Printer.CurrentX and Printer.currentY to set position and writing using Printer.Print.
Since the customer in this case is using a dot-matrix printer with 6 lables down and 2 across. When user wants to print only single label, our program prints the label and after printing it ejects the page (for full length as defined in Printer printing preferences) so user has to again roll back the page for the next label. Can anybody tell me how to force printer to stop at the point where last label is printed and not eject the page.

Thanks and Regards,

Printer Horizontal AND Vertical Printing On Same Page
How can I print on a same page horizontally and vertically with the instruction printer.print, not with a flipped picturebox...

Any Vb Code ?
If not any API ?

Cut Off Printing Page At Certain Height With Printer Object
When printing with the Printer Object - is there a way to cut-off the page at a certain height . for e.g, cut the page off at 3 inches?

Is there ANY way to do it, be it with or without the Printer object?


Cut Off Printing Page At Certain Height With Printer Object
When printing with the Printer Object - is there a way to cut-off the page at a certain height . for e.g, cut the page off at 3 inches?

Is there ANY way to do it, be it with or without the Printer object?


How To Set Page Size And Printer In Data Report In VB

I want to know how I could set the page size and printer in VB appliaction. I am Printing DataReport in Vb and I want to set page size for the reports. Kindly give me details about the solution with example.

Thank you,


Printing Last Page Of Report
Crystal Reprts XI Developer

I've created a "Consolidation" report. Through VB 6, the user enter Assembly numbers and based off of those, it will capture all of the parts that make up each Assembly entered. If a part is used in more than one Assembly, the Quantities needed are added together and on the Consolidation report, that part number is printed once with the adjusted total.
The Assembly numbers entered are captured in Recordset1.
The Parts numbers, Quantities, and other info are captured in Recordset2.

The Detail lines of my Consolidation report works great.

My Problem is:
After the last Detail line, I want to print all the Assemblies that make up the Cosolidation report. Recordset1 contains these assemblies. I may have 1 record, I may have "n" records. Each record is a different Assembly Number. I tried dragging Recordset1.field1 to the Report Footer section. When the report is previewed, it only prints out the first Assembly Number (record-1, field-1). I want it to print out ALL the records (record-2, field-1, etc) in Recordset1.

Printing VB Data Report To Another Printer
Hi, I'm trying to figure out a way to send a VB data report to another printer rather to the default printer.. I use the


which seems to print to the default printer.. The name of the printer is in a string variable..

Printing A Crystal Report To Printer
So far I've just been printing my reports to a window, but now want to print to the printer.

I set my reportfilename and printfilename and set it to print to printer, but each time I want to print it, it asks me for an output filename. I enter it, but nothing gets printed - a file with the name I specified when asked is just created.

Any suggestions??


Problem While Printing MS Access Report On A4 Page
I developed an application for a department where three tickets are generated on an A4 size paper which is pre-printed, i.e., 3 tickets are printed equally on the A4 paper. The paper thickness is approx. between 80-85 gsm.

Our application is having both options, either to print the tickets with full text (in case pre-printed stationary runs out of stock or any such problem) or print values only on the pre-printed sheet.

The application uses VB6 and MS Access Report for generating reports. The data to be printed on tickets is temporarily stored on a table and the MS Access Report retrieves it for printing.

As long as printing on blank A4 page with full text is considered, there is no problem. But as we insert the pre-printed sheet on which values only need to printed and are set with the dimensions of the pre-printed sheet, the problem occurs. The values get printed every time in a different position and to a large extent. They do not align to the printed text on the sheet. We took all the careful consideration while inserting paper, but all reports get printed with varying dimensions. The rows changes vastly.

What can be the problem? The printer is a new HP 1010 Laser printer. We enquired about this problem with some Desktop Publishing guys, some say that it might be the problem of the page thickness. Some say it might be the problem of the printer roller.

Suggest appropriate solution.

Printing Data Report In VB6 - Control End Of Page

Could someone help me with this : I am using a datareport on a supermarket app , to produce the final bill. Everything works fine , but the app always prints the full page , causing the printer to scroll forward on every bill. I did not succeed in any way to define the data report page size to be printed. Any solutions ?

Thanks Alot

Printing Report Of Varying Page Size.
hi guys n gals.
can anyone tell me how print report of custom paper sizes. I have got a customer who wants to print sales bills of varying lengths, according to the number of items. I have desinged a report in VB6 DateREport Desinger. But the printer (a dot-matrix) always prints out an A4 length even if the bill is smaller than that. I want to set the papersize at the time of priting. Can anyone tell me a solution? pleasssssseeeeeeee.........?


Crystal Report Printing Directly To Printer
hii iam trying to print report directly to printer iam using Crystalreport 8.5 and vb6
so can any one help me how to print directly iam using this code it executes but it wont print.

Me.CrystalReport1.ReportFileName = "I:Reportvbreport.rpt"
Me.CrystalReport1.DiscardSavedData = True
CrystalReport1.Destination = crptToPrinter

Access Report Duplex Printing And Page Breaks

I have a bit of a problem when printing a report from Access using duplex printing. Essentially when a group footer appears on an Even Numbered Page then the force new page property is fine as the New grouped records will be displayed on the next facing page however if the Group finishes on an Odd numbered page I need to force yet another page break so that it does not print on the back of the last page but actually starts on a new Odd numbered (facing page)

Has anyone got any ideas how I might get this to work?
Any help greatly appreciated.

My Code on the report module:

Option Compare Database
Private Sub Report_Open(Cancel As Integer)
If IsOdd(Me.Page) = True And Me.Page <> 0 Then
If Me.GroupHeader0.Visible = True Then
Me.GroupHeader0.ForceNewPage = 2

End If
End If
End Sub
Private Function IsOdd(lPageNo As Long) As Boolean
IsOdd = IIf((lPageNo Mod 2) = 0, False, True)
End Function
Private Sub Report_Page()
End Sub


Group Section - Extra Blank Page When Using The Option "New Page After"
In crystal report 9, I designed a report with a list of records grouped by card number. As I wanted each group to be printed on a different page, I went to the edit section for the group footer and select the "New Page After" option.

The problem is that when displaying / printing the report, there is always an extra page after the last group : it comes out with the header and the rest is blank.

How can I avoid this page to appear ?

Thanks for you help !

Printer Change Page Orientation From Page To Page
I'm running VB 5. Is it possible to change the page orientation from one page to another.

portion of code:
If page_orientation(gridno) = 0 Then
Printer.Orientation = vbPRORPortrait
Printer.Orientation = vbPRORLandscape
End If

If I use "Printer.EndDoc" before the above code, the program works fine. Each page is a separate 'print-job' with the orientation that I want. A problem arises when I want to print to a .PDF printer: each page is saved as a separate PDF because they're all separate 'print jobs'.

If I substitute "Printer.EndDoc" with "Printer.NewPage", I get the error "orientation property cannot be set within a page". Is there any way to get around this?

How To Show "Select Printer" Dialog Before Printing A Crystal Report?
Hi everyone.
I use Crystal Reports 8.5
In my code I always call the: mycrviewer.ViewReport command. When the report shows up if I press print button it only shows me a dialog with the default printer to set number of copies and pages to print.
I would like to show up a dialog which let me select the printer and adjust other printer settings (like paper size, etc.) like DataReport does.
How can I do this?

Thanks for your time and help!

How To Show "Select Printer" Dialog Before Printing A Crystal Report?
Hi everyone.
I use Crystal Reports 8.5
In my code I always call the: mycrviewer.ViewReport command. When the report shows up if I press print button it only shows me a dialog with the default printer to set number of copies and pages to print.
I would like to show up a dialog which let me select the printer and adjust other printer settings (like paper size, etc.) like DataReport does.
How can I do this?

Thanks for your time and help!

Adding Blank Page...
are there is a way to add a blank page during runtime? can this pagebe with even the header?

i use macro to print large sum of documents each week, in booklet. i want to find a way to add a blank page to the documents with less then three pages.

are there is a way?

Blank Page In Crystal...
Hi !!!

Sometimes, my beloved crystal ("#$%/&/%&) sends me a blank page at the begining of my report.

Any clue before uninstaling it??? (just kidding)

Thanks in advance...

Print Blank Page?
How do I print a totally blank page? Without page numbers and everything. Thanks in advance!!

Printer.Paintpicture Is Blank
Can't see what I am doing wrong here.  I'm trying to print the contents of a picture box to a pdf.  The pdf file ends up around the right size but it has a white background and not my pretty picture.  The picture box shows the picture ok. All I am doing is
 Printer.PaintPicture picBackground, 0, 0, DINA4_X, DINA4_Y

where dina4_x = 11906
and dina4_y is 16837

I've done this before perfectly ok.

Detecting Blank Page In WORD
Hi there..

Im currently working in VB6 and automating WORD.
How can i know that a page in word is a blank page(which i mean does not contain text, picture, tables, etc..)

Please help...


Intermittent Blank Page In Webbrowser
I am using on Vista but suspect this may be a more general webbrowser problem that VB6 users may know about.

In an educational program I have various blocks of picture buttons each with an information button which bring up a webpage where the filename is determined by form and the bookmark by the button block number as here:-

.Navigate(New System.Uri("file:///" & fname & "#" & blkid))

This is fine most of the time but occasionally it shows blank even though webpage properties show it is using the correct page and bookmark. Tried opening "about:blank" first and refresh after each navigate but these don't help.

In the VB6 version I did not get the problem but I was closing the form after each use, I can't do that in stupid .net!

Ta for any other suggestions.

Logging Into Blank Web Page....sort Of....
My project is supposed to accept a user ID and password and verify it (by checking it against those listed in an Access database). If the user ID and password are correct, it is supposed to open up a blank web page. If they are incorrect, it pops up an error message.
I have the incorrect password part working but I can't get it to accept a valid password and open a blank web page....Can you help?


Private Sub cmdVerifyButton_Click()

Dim strPassword As String
strPassword = txtPassword.Text

adoVerification.Recordset.Find "[Customer ID] = '" & strPassword & "'", , adSearchForward

If adoVerification.Recordset.EOF Then
MsgBox "Customer Not Found!", vbExclamation, "Invalid Customer"
Else: MsgBox "Customer Found!", vbExclamation, "Valid Customer"
End If

End Sub

Section And Blank Page On Print
Hi all !

on a vb application, i need to print a word document.
This document can have several sections with differents

For many things, i need to work on section by section.
So i print section by section.
And there is a problem :
For a section with X pages, word print X+1 pages. The last
page is a blank page....In more, sometimes it doesn't
happen. So....
Why word put a blank page in more ?
How i can do to print only X pages ????

Can u help me please ? Because, it make me crazy !

Thx for any help


sorry for bad english, it is not my main language...

{NOT SOLVED}How Do I Add A Blank Space For Page 2 Of CR 8?
Hi every body!

Using CR 8 I want the page 2 to have blank space at top of the page, but not appear this space my first page. How can I do this?

Your feedback is highly appreciated.

Thank u in advance.

Yours truly,

Abdifatah Dayib Mo’alim

Edited by - Dayib12 on 6/27/2005 1:17:10 AM

Blank Page After Grouping!!! Need To Remove!
I have a very annoying issue and I tried just about everything to get rid of it...

This is the problem - I have 4 groupings on my Crystal 8.0 report. I do not use KeepTogether, NewPageBefore or NewPageAfter or any of those functions. However, on the first page, the report displays (and prints) the Report header, Page header and the first group. The rest of the page is blank. Then, on the second page, the remaining groups are displayed along with the details section. There are no problems with the footers. It happens only on the first page!

Any suggestions, please???



My Printer Just Churns Out Blank Paper!!
I've got a large string which i'm trying to print (ie, send to the printer) called printstr.

On Error GoTo err1
CommonDialog1.PrinterDefault = True
CommonDialog1.CancelError = True

Printer.Font = "Arial"
Printer.ColorMode = 1

Print printstr


This just send blank pages out the printer... does anyone have a suggestion?

Is there a function to call the system print command on a text file?


Printer Just Feeds Out Blank Paper
Hello to everyone viewing.

I have a printing problem.

My VB6 program has to print a list which comprises of a header, a few labels and the contents of a listview, the code I use is posted below.

Most of the time this code works perfectly fine and prints the list as required but every now and again when I try to print the list, the printer just feeds out blank sheets out paper continuously and prints nothing.

I have tried my program on 3 seperate computers with 3 different types of printer, they all print ok but all 3 just feed out paper occasionaly.

Here is my code.
Code:Private Sub cmdPrint_Click() 'Print ListView command
   Dim a As clsPrintLV
   Set a = New clsPrintLV 'Call Print Class module

   a.PrintListView ListView1
   MsgBox "The current list has been sent to the Printer.", vbInformation, "Print Manager"
End Sub

Option Explicit

Public Event MaxYReached(ByVal CurrentY As Double, ByRef oPrinter As Object, ByRef bRePrintHeader As Boolean)
Public Event Progress(ByVal oNextListItem As ListItem, ByRef oPrinter As Object, ByRef bRePrintHeader As Boolean, ByVal lTotalLines As Long, ByRef bCancel As Boolean)
Dim Page As Integer
Private mlFromX As Long

Public Sub PrintListView(lvListview As ListView, Optional ByVal oPrinter As Object, Optional ByVal bLines As Boolean = False, Optional ByVal bBlackAndWhite As Boolean = True, Optional ByVal MaxY As Double, Optional ByVal lFromX As Long)
    Dim oListItem As ListItem
    Dim oSubItem As ListSubItem
    Dim oColumnHeader As ColumnHeader
    Dim iCounter As Integer
    Dim lPrevY As Long
    Dim sCorrectPrintText As String
    Dim bRePrintHeader As Boolean
    Dim bCancel As Boolean
    MaxY = 15000
    mlFromX = lFromX
    Set oPrinter = Nothing
    If oPrinter Is Nothing Then
        Set oPrinter = Printer
    End If
    With oPrinter
        .Font = lvListview.Font
        .FontSize = 10
        Call PrintHeader(lvListview, oPrinter)
        .CurrentY = .CurrentY + .TextHeight(" ") + (.TextHeight(" ") / 2)
        For Each oListItem In lvListview.ListItems
            bRePrintHeader = False
            RaiseEvent Progress(oListItem, oPrinter, bRePrintHeader, lvListview.ListItems.Count, bCancel)
            If bCancel Then
                Exit For
            End If
            If bRePrintHeader Then
                Call PrintHeader(lvListview, oPrinter)
            End If
            Set oColumnHeader = lvListview.ColumnHeaders(1)
            lPrevY = .CurrentY
            .CurrentY = lPrevY
            .CurrentX = .CurrentX - oListItem.Width
            Select Case oColumnHeader.Alignment
                Case lvwColumnLeft
                    .CurrentX = mlFromX + oListItem.Left + 550 'sets print distance from left for 1st column
                Case lvwColumnRight
                    .CurrentX = mlFromX + oListItem.Left + oListItem.Width - .TextWidth(oColumnHeader.Text) - 120
                Case lvwColumnCenter
                    .CurrentX = mlFromX + oListItem.Left + ((oListItem.Width - .TextWidth(oListItem.Text)) / 2)
            End Select
            .ForeColor = IIf(bBlackAndWhite, vbBlack, oListItem.ForeColor)
            If oListItem.Width > 15 Then
                sCorrectPrintText = Trim$(oListItem.Text)
                If .TextWidth(sCorrectPrintText) > oColumnHeader.Width - 60 Then
                    Do Until Not .TextWidth(sCorrectPrintText & "...") > (oColumnHeader.Width - 120)
                        sCorrectPrintText = Mid$(sCorrectPrintText, 1, Len(sCorrectPrintText) - 1)
                    sCorrectPrintText = sCorrectPrintText & "..."
                End If
                Debug.Assert sCorrectPrintText = Trim$(oListItem.Text)
                oPrinter.Print sCorrectPrintText; 'Because of some weird bug there has to be oPrinter before this
                                                        ' If i dont add the oPrinter i get a syntax error
            End If
            .CurrentY = lPrevY
            For Each oSubItem In oListItem.ListSubItems
                Set oColumnHeader = lvListview.ColumnHeaders(oSubItem.Index + 1)
                Select Case oColumnHeader.Alignment
                    Case lvwColumnLeft
                        .CurrentX = mlFromX + oColumnHeader.Left + 550 'sets print distance from left for sub item columns
                    Case lvwColumnRight
                        .CurrentX = mlFromX + oColumnHeader.Left + oColumnHeader.Width - .TextWidth(oSubItem.Text) - 120
                    Case lvwColumnCenter
                        .CurrentX = mlFromX + oColumnHeader.Left + ((oColumnHeader.Width - .TextWidth(oSubItem.Text)) / 2)
                End Select
                .ForeColor = IIf(bBlackAndWhite, vbBlack, oSubItem.ForeColor)
                If oColumnHeader.Width > 15 Then
                    sCorrectPrintText = Trim$(oSubItem.Text)
                    If .TextWidth(sCorrectPrintText) > oColumnHeader.Width - 120 Then
                        Do Until Not .TextWidth(sCorrectPrintText & "...") > (oColumnHeader.Width - 120) Or (sCorrectPrintText = "")
                            sCorrectPrintText = Mid$(sCorrectPrintText, 1, Len(sCorrectPrintText) - 1)
                        sCorrectPrintText = sCorrectPrintText & "..."
                    End If
                    oPrinter.Print sCorrectPrintText;
                End If
                .CurrentY = lPrevY
            .CurrentY = .CurrentY + oListItem.Height
            If .CurrentY > MaxY Then
                Call PrintHeader(lvListview, oPrinter)
                .CurrentY = .CurrentY + .TextHeight(" ") + (.TextHeight(" ") / 2)
            End If
    End With
    oPrinter.Print ""
    oPrinter.Print ""
    oPrinter.Print ""
    oPrinter.CurrentX = 8000
    oPrinter.Print "Outstanding Balance : £" & " " & frmOtstngAcc!lblBal.Caption
End Sub

Public Sub PrintHeader(lvListview As ListView, oPrinter As Object)
    Dim lPrevY As Long
    Dim oColumnHeader As ColumnHeader
    Dim sCorrectPrintText As String
    Page = Page + 1
    With oPrinter
        'Print Date
        .CurrentX = 490
        .CurrentY = 2500
        oPrinter.Print "Date : " & frmOtstngAcc!lblDate2.Caption
        'Print Page number
        .CurrentX = 10100
        .CurrentY = 2500
        oPrinter.Print "Page : " + Str(Page)

        'Print Insurance Company
        .CurrentX = 490
        .CurrentY = 3000
        oPrinter.Print "Company : " & frmOtstngAcc!cboInsCo.Text
        'Print label Outstanding Accounts
        .CurrentX = 4500
        .CurrentY = 3500
        .FontUnderline = True
        oPrinter.Print "OUTSTANDING ACCOUNTS"
        .FontUnderline = False
        For Each oColumnHeader In lvListview.ColumnHeaders
            If oColumnHeader.Width > 60 Then
                lPrevY = 4000 'sets print distance from top
                Select Case oColumnHeader.Alignment
                    Case lvwColumnLeft
                        .CurrentY = 4000 ''sets print distance from top for 1st column header
                        .CurrentX = mlFromX + oColumnHeader.Left + 550 'sets print distance from left for 1st column header
                    Case lvwColumnRight
                        .CurrentX = mlFromX + oColumnHeader.Left + oColumnHeader.Width - .TextWidth(oColumnHeader.Text) - 120
                    Case lvwColumnCenter
                        .CurrentX = mlFromX + oColumnHeader.Left + ((oColumnHeader.Width - .TextWidth(oColumnHeader.Text)) / 2) + 900
                End Select 'sets print distance from left for Date column
                If oColumnHeader.Width > 15 Then
                    sCorrectPrintText = Trim$(oColumnHeader.Text)
                    If sCorrectPrintText <> "" Then
                        If .TextWidth(sCorrectPrintText) > oColumnHeader.Width - 120 Then
                            Do Until Not .TextWidth(sCorrectPrintText & "...") > (oColumnHeader.Width - 120) Or (sCorrectPrintText = "")
                                sCorrectPrintText = Mid$(sCorrectPrintText, 1, Len(sCorrectPrintText) - 1)
                            sCorrectPrintText = sCorrectPrintText & "..."
                        End If
                        oPrinter.Print sCorrectPrintText;
                    End If
                End If
                .CurrentY = lPrevY
            End If
        'Print Line
        Printer.DrawWidth = 8
        oPrinter.Line (250, 4275)-(11200, 4275)
    End With
End Sub
Please help me if you can.
I've got to go out to work now so I wont be able to reply to any posts untill tommorow 12.00 GMT



How To Make A Button Open A Blank IE Page?
When I click the button.IE will open a blank page.How to do that in VB?Thanks a lot.

ActiveReport Prints An Additional Blank Page
Hi all,
I have an ActiveReport that should print only 1 page; after I realigned some controls - pulled them up higher - the report prints now a blank page between 2 reports. I tried putting the controls back where they were, the printing issue still there. When I print 2 reports, between the two I have a blank.

I've attached a snapshot of the "details" object's properties.
I have canGrow = false; shouldn't this prevent the report from growing vertically?


Printing Blank Problem
I'm trying to print the contents of picGraph (a picturebox which has a hDC -- I've drawn on this DC with Bitblt) . I'm using the following code to print:

Call Printer.PaintPicture(picGraph.Image, 0&, 0&)

However, it doesn't print the contents of the picturebox -- just a blank grey area. Any ideas? Should I be using something else but picGraph.Image? Thanks.

URGENT: Data Report (Page Header On Each Page)

I am using Data Report (why?!!) to print a bill. It contains the company name and other information such as date and total amount etc.

I am doing this by coding only. NO DATA ENVIRONMENT (!).

I have put a lable on the Page header and I am displaying the company name in that lable. It prints perfactly on the first page of the bill. But it does not appear on the second page of the bill. Instead it displays the remaining items of the bill from the beginning.

I want to print company name on each page of the bill. this is shown in the image.

Is there a way to get the out put like this?

Please help me. Its urgent.

Thank a ton in advance.

Setting Printer In Draft Mode For DOS Printing Speed && Output As DOS Printing
I want to print in Draft Mode with DOS Printing Speed using DataReport Designer. Anybody can help me How to set dot matrix printer in Draft Mode i.e., speed of printing must be same as DOS Printing Speed.
I am using Code:Printer.PrintQuality = vbPRPQDraft but this code is applicable for resolution quality and printing time is taking same as printing from Windows environment and I need output same as DOS Printing
Is there any special codes, functions or printer properties to be adopted for DOS Printing Speed. I appreciate if anybody can help me for giving me a sample project.
My email is :

Regards / MANI

Printing To Zebra Printer With ZPL Or Printer Object

I know that this question isn't all VB, but I tried to get some info in the barcode forum, but there isn't any traffic there so I thought I could try here.

For the past 10 or 15 years we have used two Zebra label printers hooked up to a computer via serial port and  have sent ZPL to it. We decided to upgrade to newer Zebra printers with network cards so we can print images on the labels, which they have pretty much done what I planned, but I am running into some complications.

With the new printers I used VB6’s printer object and set X and Y coordinates to print my text and bar codes on the labels just like I do with many other documents that I send to HP LaserJets. I am not going to get into the issues that I am having, because I don't think it is relevant (but if you think so I will post it).

My main question is everything I read says to write the txt file and send ZPL to the printer. Why is this used instead of VB6's printer object? I have about 80 users that send print jobs to these printers and wondered if creating a ZPL file was a better way of printing. And, if writing a ZPL text file, where would be a proper place to save the file before it is sent to the printer.

Any input or experience would be greatly appreciated, I am going crazy with this!


RESOLVED: Blank Pages When Printing Flexgrid
Found a solution. Deleted msfTemp and created copy of Grid1 named msfTemp. Worked fine.

I found some great code to help me with the printing of flexgrids, which I incorporated in a user object I am working on in a subroutine:

VB Code:
Dim msfGrid As MSFlexGrid    Dim c, r, p, iRowsPerPage, iPages As Integer    Dim toprow, bottomrow, x As Integer         Set msfGrid = Grid1     iRowsPerPage = 55 'number of rows per page        msfTemp.Clear        msfTemp.FixedCols = 0    msfTemp.FixedRows = 1    msfTemp.Cols = msfGrid.Cols    msfTemp.Rows = iRowsPerPage    msfTemp.FormatString = Grid1.FormatString     If msfGrid.Rows Mod iRowsPerPage = 0 Then        iPages = msfGrid.Rows / iRowsPerPage    Else        iPages = msfGrid.Rows / iRowsPerPage + 1    End If     For c = 0 To msfGrid.Cols - 1        msfTemp.ColWidth(c) = msfGrid.ColWidth(c)    Next c     msfTemp.Width = Printer.Width     If msfGrid.Rows < iRowsPerPage Then        bottomrow = msfGrid.Rows    Else        bottomrow = iRowsPerPage - 1    End If        toprow = 1        For p = 1 To iPages            'Headers            For c = 0 To msfGrid.Cols - 1                msfTemp.TextMatrix(0, c) = msfGrid.TextMatrix(0, c)            Next c        '    r = r + 1        'End If        x = 1         For r = toprow To bottomrow            For c = 0 To msfGrid.Cols - 1                msfTemp.TextMatrix(x, c) = _                    msfGrid.TextMatrix(r, c)            Next c            x = x + 1        Next r         Printer.PaintPicture msfTemp.Picture, 100, 100                   Printer.NewPage            toprow = bottomrow + 1        bottomrow = toprow + iRowsPerPage - 2        If msfGrid.Rows < bottomrow Then _           bottomrow = msfGrid.Rows - 1        Next p     Printer.EndDoc     Set msfGrid = Nothing

I get blank pages trying to print from msfTemp. If is a flexgrid that I have placed behind Grid1 (which is my main grid).

If I print from Grid1, I get at least something, but I am trying to format for a specific number of lines on the page.

I am a relative newbie, and any suggestions are greatly appreciated.


Blank Report

I m developing a VB application with crystal reports 8.5 (RDC).

When the report is displayed in the CRViewer control in a form, I set the windowstate of the form to minimized. When the user clicks on the form in the task bar, the form is maximized but the report in CRViewer is blank, if user clicks on the restore button on the form, the report is displayed properly.

I checked with the refresh option, but that did not help.

Urgent solution is required.

Thanking in advance

Copyright 2005-08, All rights reserved