VBA用SQL方法连接TXT文件问题
Sub aa()Dim cnn As New Connection'Dim aa As New 数据库字符串sql = "Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties='text;IMEX=1;HDR=NO;FMT=Delimited;';Data Source=" & ThisWorkbook.Path & "\123.txt"cnn.Open sqlIf cnn.State = 1 Then '判断是否连接成功MsgBox "连接成功"Else: MsgBox "no"End IfEnd Sub