|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
求助 求助
为了提高效率,不想打开多份原始文件;
在用ADO对CSV文件进行链接读取到红色位置的时候,发现无法工作,报错;附件同步提供
==========
typer = "*.*s*"
mypath = Application.ThisWorkbook.Path & FolderName & ThisWorkbook.Sheets(kk + 1).name & "\"
name = Dir(mypath & "\" & typer, vbDirectory)
Set Conn = CreateObject("ADODB.Connection")
Set Rst = CreateObject("ADODB.Recordset")
SqLPath = mypath
SQLSheetsName = name
Sql = "select * from [" & SQLSheetsName & "]"
Conn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties = 'Text;HDR=NO;FMT=Delimited(,)';Data Source=" & SqLPath
Set Rst = Conn.Execute(Sql)
ThisWorkbook.Sheets("中转页面").Cells(1, 1).CopyFromRecordset Rst
==========
|
|