?
Solved

Print an MSFlexGrid _and_ the form it's on

Posted on 2002-04-12
4
Medium Priority
?
249 Views
Last Modified: 2010-05-02
Hello all
I have some forms that have text and up to two different MSFlexGrids on them.
If I use PrintForm the Grids are black on our HP laserjets.  If I use the old Printer.PaintPicture grdDisputes.Picture, 0, 0, the data in the Grids prints fine, but obviously that doesn't print anything else but the grid.
SO, the points are for the code to a function (which'll be called from the form itself) that prints the form and the Grid, with the Grid data visible, not blacked out.

Thanks

v
0
Comment
Question by:vlg
  • 2
4 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 800 total points
ID: 6936986
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6936989
this is a duplicate question of http://www.experts-exchange.com/questions/Q.20288032.html.

please delete this one.
0
 
LVL 1

Expert Comment

by:surajdeo
ID: 6937032
hi,
 
 u can print using printer object, here i am giving one example, in which form is contaning textboxes, label datepicker and flexgrid and a button. if u r clicking print button all the data will be print.


Private Sub CmdPrint_Click()

       
        Printer.PaperSize = vbPRPSA4
        Printer.FontSize = 10
        Printer.FontBold = True
       
        Printer.CurrentX = 1000
        Printer.CurrentY = 1000
        Printer.Print "CustCode : " & VL_Int_CustCode

        Printer.CurrentY = 1000
        Printer.CurrentX = 4400
        Printer.Print "Date : " & dtpSalesDate.Value


        Printer.CurrentX = 1000
        Printer.CurrentY = 1500
        Printer.Print "BilNo : " & txtBilNo.Text


        Printer.CurrentX = 1000
        Printer.CurrentY = 2000
        Printer.Print "Patient : " & txtPatientName.Text

        Printer.CurrentY = 2000
        Printer.CurrentX = 4400
        Printer.Print "Pay Mode : " & cmbModeOfPay.Text


        Printer.CurrentX = 1000
        Printer.CurrentY = 2500
        Printer.Print "Doctor : " & txtDoctorName.Text

        Printer.CurrentY = 2500
        Printer.CurrentX = 4400
        Printer.Print "Sales Return : " & lblSReturn.Caption

                       
        Printer.CurrentX = 500
        Printer.CurrentY = 3200
       
        Dim i, cy, cx
        For i = 0 To MSFGSales.Rows - 1
            If i > 0 Then Printer.FontBold = False
           
            cy = Printer.CurrentY
            Printer.CurrentX = 1000
            Printer.Print MSFGSales.TextMatrix(i, 0)
           
            Printer.CurrentX = 1650
            Printer.CurrentY = cy
            Printer.Print MSFGSales.TextMatrix(i, 1)
           
            Printer.CurrentX = 2750
            Printer.CurrentY = cy
            Printer.Print MSFGSales.TextMatrix(i, 2)
           
            Printer.CurrentX = 5000 '4850
            Printer.CurrentY = cy
            Printer.Print MSFGSales.TextMatrix(i, 3)
           
            Printer.CurrentX = 6000 '5850
            Printer.CurrentY = cy
            Printer.Print MSFGSales.TextMatrix(i, 4)
           
            Printer.CurrentX = 7500 '7000
            Printer.CurrentY = cy
            Printer.Print MSFGSales.TextMatrix(i, 5)
           
            Printer.CurrentX = 8150 '7650
            Printer.CurrentY = cy
            Printer.Print MSFGSales.TextMatrix(i, 6)
           
            Printer.CurrentX = 9000 '8300
            Printer.CurrentY = cy
            Printer.Print MSFGSales.TextMatrix(i, 7)
            If i >= 0 Then Printer.CurrentY = Printer.CurrentY + 300
        Next i
       
        Printer.CurrentX = 5500
       
        cx = Printer.CurrentX
       
        Printer.CurrentX = cx
        Printer.CurrentY = Printer.CurrentY + 700
        Printer.Print "TotAmount : " & txtTotAmount.Text
       
        Printer.CurrentX = cx
        Printer.CurrentY = Printer.CurrentY + 400
        Printer.Print "SRD : " & txtSRD.Text
       
        Printer.CurrentX = cx
        Printer.CurrentY = Printer.CurrentY + 400
        Printer.Print "Amount to Pay : " & txtTMtPay.Text
       
        Printer.CurrentX = cx
        Printer.CurrentX = 700
        Printer.CurrentY = 10000
        Printer.Print "Page No : " & Printer.Page
        Printer.EndDoc
               
   
End Sub
0
 

Author Comment

by:vlg
ID: 6937363
It worked, although M$ should be ashamed of themselves if that's the best solution they can provide - but thanks for the prompt, relevant response - very much appreciated.

v
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month14 days, 13 hours left to enroll

839 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