| 
    
     |  | ▼りった さん: >Accessに入れてみたり、ODBCに入れてみたりしてだましだまし運用しているのですが、どちらも微妙な制限が付きまとうので、
 
 上記のことがどのようなことか分かりませんが、
 下記の要領で試してみて下さい。
 
 Sub Ado_CsvTest()
 Dim cn     As ADODB.Connection
 Dim rs     As ADODB.Recordset
 Dim strFName  As Variant
 Dim strDBName As String
 Dim strTBLName As String
 Dim strSQL   As String
 Dim i     As Long
 
 'strFName = ThisWorkbook.Path & "\TEST.csv"
 
 'データベース名およびテーブル名の生成
 strTBLName = "TEST.csv"
 strDBName = ThisWorkbook.Path & "\"
 
 'データベースに接続
 Set cn = New ADODB.Connection
 With cn
 .Provider = "Microsoft.Jet.OLEDB.4.0"
 .Properties("Data Source").Value = strDBName
 .Properties("Extended Properties").Value = "Text;HDR=Yes;"
 End With
 cn.Open
 
 strSQL = "SELECT * FROM [" & strTBLName & "]"
 
 'レコードセットを取得
 Set rs = New ADODB.Recordset
 With rs
 .ActiveConnection = cn
 .CursorLocation = adUseClient
 .CursorType = adOpenStatic
 .LockType = adLockReadOnly
 .Source = strSQL
 .Open , , , , adCmdText
 End With
 
 With Worksheets("Sheet1")
 .Cells.ClearContents
 For i = 1 To rs.Fields.Count
 .Cells(1, i).Value = rs.Fields(i - 1).Name
 Next
 .Range("A2").CopyFromRecordset rs
 End With
 rs.Close
 cn.Close
 Set rs = Nothing
 Set cn = Nothing
 End Sub
 
 |  |