Public Sub b1CSV_読込み()
Sheets(1).Select
Range("d1:e65536").ClearContents
Dim mySQL As String
Dim i As Long
Dim name
name = Range("c2").Value
Call a03_InODBC
mySQL = "select F1 as 回数,F2 as 当選番号" _
& " from " & name & ".csv" 'ファイル名がテーブル名になる
Set rs = cn.Execute(mySQL)
With rs
'フィールド名
For i = 1 To .Fields.Count
Cells(1, i + 3).Value = .Fields(i - 1).name
Next
'レコード
Range("d2").CopyFromRecordset rs
'.Close
End With
Call a09_OutODBC
End Sub