Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing from a msflexgrid

Status
Not open for further replies.

sexydog

Programmer
Jul 9, 2002
176
GB
hi

i need to print all my data including my colum headings from a msflexgrid.how can i do this


thanks
 
You could use something similar to the following to step through each cell in the grid and send the Text of that cell to the printer object. When actually used, I put in additional code to handle page count (based on total rows in flexgrid) and printing page headers/footer, etc.



With frmGrid.flxData ' Flex grid with data
For intRow = 1 To intRecCount ' Loop for each line to print.
.Row = intRow ' Set flex grid row.
Printer.Print Space(5);
For intCol = 0 To intLastCol ' Last col var previously set
.Col = intCol ' Set flex grid Column.
If (.ColWidth(intCol) <> 0) Then
' Only print data that is visible in flex grid
Printer.Print .Text & vbTab;
End If
Next
Printer.Print
Next
End With
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top