-
Hello,
How do I print the contents of an MSFlexGrid to a printer, or even simply to a .txt or .xls file that I can open in
Notepad, Word or excel then print?
At the moment I am only able to read the first cell of the MSFlexGrid into either a .txt or .xls file...
Below is code I am working with at the moment:
Code:
Private Sub Command2_Click()
Dim dTEXTFILE As String
Dim dTEXT As String
dTEXTFILE = "C:\FILE.XLS"
dTEXT = MSFlexGrid1.Text
Open dTEXTFILE For Output As #1
Print #1, dTEXT
Close #1
End Sub
Any help would be greatly appreciated, thanks very much,
Andy............
-
You can print MsFlexGrid like this:
Code:
Private Sub Command1_Click()
Printer.PaintPicture MSFlexGrid1.Picture, 0, 0
Printer.EndDoc
End Sub
-
Hi there, finally I'm back ...
Want to try this for example. (save to txt file...)
'Assumed 'ya know the nos. of cols.
open "tempfile.txt" for output as #1
dim iCtr as integer
With MSFlexGrid1
For iCtr = 1 To .Rows - 1
yourvar1 = .TextMatrix(iCtr, 0) ' first col
yourvar2 = .TextMatrix(iCtr, 1) ' second "
yourvar3 = .TextMatrix(iCtr, 2) ' third "
Write #1,yourvar1,yourvar2,yourvar3
Next
End With
close #1
' Hope this can help ya