VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Export Excel file in to MSFlexGrid

by Karthick (2 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Mon 24th April 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Export Excel file in to MSFlexGrid

API Declarations


Dim rs As New ADODB.Recordset

Rate Export Excel file in to MSFlexGrid




con.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\karthik\testfiles\bctest.xls;Extended Properties=Excel 8.0;Persist Security Info=False")
Set rs = con.Execute("select * from [bctest$]")

i = 1
MsFlexgrid1.Rows = 2
MsFlexgrid1.Cols = rs.Fields.Count
Do While Not rs.EOF
For j = 0 To rs.Fields.Count - 1
    MsFlexgrid1.TextMatrix(0, j) = IIf(IsNull(rs.Fields(j).Name), "", rs.Fields(j).Name)
    MsFlexgrid1.TextMatrix(i, j) = IIf(IsNull(rs.Fields(j).Value), "", rs.Fields(j).Value)
    str = str + IIf(IsNull(rs.Fields(j).Value), "", rs.Fields(j).Value)
Next
i = i + 1
If MsFlexgrid1.Rows <= i Then
    MsFlexgrid1.Rows = datagrid1.Rows + 1
End If
rs.MoveNext
Loop

Msflexgrid1.Rows = datagrid1.Rows - 1
Text1.Text = str
End Sub

Download this snippet    Add to My Saved Code

Export Excel file in to MSFlexGrid Comments

No comments have been posted about Export Excel file in to MSFlexGrid. Why not be the first to post a comment about Export Excel file in to MSFlexGrid.

Post your comment

Subject:
Message:
0/1000 characters