|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
求助 求助
为了提高效率,不想打开多份原始文件;
在用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
==========
|
|