execl和VB的问题
急求~~~~~~~~~~怎么把EXECL导入到vb中的datagrid里 --------------------编程问答-------------------- 我刚写的一段代码,供你参考吧。
Private Sub Cmd_import_Click()
Dim cnExcel As New ADODB.Connection
Dim rsExcel As New ADODB.Recordset
Dim path As String
CommonDialog1.Action = 1
path = CommonDialog1.FileName
Set cnExcel = New ADODB.Connection
cnExcel.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source='" + path + "';Extended Properties='Excel 8.0;HDR=Yes'"
cnExcel.CursorLocation = adUseClient
cnExcel.Open
Set rsExcel = New ADODB.Recordset
If rsExcel.State = adStateOpen Then rsExcel.Close
rsExcel.Open "select * from [sheet1$]", cnExcel, adOpenDynamic, adLockOptimistic
Set Grid1.DataSource = rsExcel
End Sub
--------------------编程问答-------------------- 请问如何将EXCEL表导出。
补充:VB , 资源