| 
    
     |  | いつもお世話になっております。 クエリを使ってCSVをEXCELに読み込みます。
 その際に、出力させたEXCELのファイル名を
 CSVのファイル名と同じファイル名に変更できますでしょうか?
 どなたかお知恵をお貸しください。
 
 Sub CSV読み込み()
 Dim aFile As Variant
 rFile = Application.GetOpenFilename
 With ActiveSheet.QueryTables.Add(Connection:= _
 "TEXT;" & rFile, Destination:=Range("A2"))
 .Name = "R123-2-1"
 .FieldNames = True
 .RowNumbers = False
 .FillAdjacentFormulas = False
 .PreserveFormatting = True
 .RefreshOnFileOpen = False
 .RefreshStyle = xlInsertDeleteCells
 .SavePassword = False
 .SaveData = True
 .AdjustColumnWidth = True
 .RefreshPeriod = 0
 .TextFilePromptOnRefresh = False
 .TextFilePlatform = xlWindows
 .TextFileStartRow = 1
 .TextFileParseType = xlDelimited
 .TextFileTextQualifier = xlTextQualifierDoubleQuote
 .TextFileConsecutiveDelimiter = False
 .TextFileTabDelimiter = False
 .TextFileSemicolonDelimiter = False
 .TextFileCommaDelimiter = True
 .TextFileSpaceDelimiter = False
 .TextFileColumnDataTypes = Array(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, _
 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1)
 .Refresh BackgroundQuery:=False
 End With
 
 End Sub
 
 |  |