I generated this Macro using the Developer "Record Macro" function. It worked importing the data during the Macro Creation process. However, when I try to re-run the Macro to test for re-use when wanted, I get the "Run-time error 5 Invalid procedure call
or argument" on the .CommandType=0 line.
Sub Macro2()
'
' Macro2 Macro
'
'
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Scripts\Litigation Hold and eDiscovery\LitigationHoldInfo.csv", _
Destination:=Range("$A$5"))
.CommandType = 0
.name = "LitigationHoldInfo_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = False
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = True
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
ActiveWorkbook.Save
End Sub