Printing DataGrid in VB

salam
I'm working on a VB-Access project and I want to print the content of a datagrid without the other controls present on the form. Additionally, the datagrid is not fully displayed and requires scrolling.
Is there a direct method to do this? If not, is there a trick to export the content of the datagrid to Ms Excel?

5 answers

  1. Thank you very much!
    3
    1. Hello, I am currently working on a project based on Visual Basic. The problem I am facing is as follows: I would like to print the data located just in the datagrid of the form. Thank you in advance for your help.
      0
      1. ```vb Private Sub CmdPrint_Click()
        Dim RRow As Integer, RecCount as integer
        reccount=adodc1.recordset.recordcount
        printer.print ""
        For RRow = 0 To 13 ' change this to suit your need
        or reccount
        DataGrid1.Row = RRow

        printer.Print DataGrid1.Columns(0).Text, Space(1), DataGrid1.Columns(1).Text, Space(1), DataGrid1.Columns(2).Text '
        Next
        printer.enddoc
        End Sub ```
        0
      2. There is no video version for this answer.
        0
    2. Hello, since I can't implement these methods, I'm wondering if one of you could help me transfer the data from my datagrid in VB6 to Word or PDF. Thank you.
      0