EXCEL导入gridvid
请教用vb6.0实现,将execel的第一行数据导入到控件gridvid --------------------编程问答-------------------- Set xl = New Excel.Applicationxl.Visible = True 'make the excel application visible
xl.Workbooks.Add
xl.Workbooks.Open ("d:\Book1.xls")
Dim rng As Range
Dim i As Integer, j As Integer
Set rng = xl.ActiveSheet.UsedRange
i = rng.Rows.Count
j = rng.Columns.Count
Dim sqlstr As String
sqlstr = "select "
For i = 1 To j
sqlstr = sqlstr & " '" & rng.Cells(1, i) & "',"
Next i
sqlstr = Left(sqlstr, Len(sqlstr) - 1)
adors.Open sqlstr
Set DataGrid1.DataSource = adors
补充:VB , 资源