vb实现对某一文件夹下的多个excel文件访问并读取其中某几行 5
1个回答
展开全部
'引用一行,如第1行
Sub onerow()
Dim Sql$
Set Conn = CreateObject("Adodb.Connection")
Conn.Open "provider=microsoft.jet.oledb.4.0;extended properties='excel 8.0;hdr=no';data source=" & ThisWorkbook.Path & "\1.xls"
Sql = "select * from [sheet1$a1:iv1]"
Cells.Clear
[a1].CopyFromRecordset Conn.Execute(Sql)
Conn.Close
Set Conn = Nothing
End Sub
Sub onerow()
Dim Sql$
Set Conn = CreateObject("Adodb.Connection")
Conn.Open "provider=microsoft.jet.oledb.4.0;extended properties='excel 8.0;hdr=no';data source=" & ThisWorkbook.Path & "\1.xls"
Sql = "select * from [sheet1$a1:iv1]"
Cells.Clear
[a1].CopyFromRecordset Conn.Execute(Sql)
Conn.Close
Set Conn = Nothing
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |