I am getting the above error in the below code.
Sub Read_Val()
Dim req_val(1 To 50) As String
Dim fName As String
Dim fPath As String
Dim FPtt As String
Dim wsRaw As Worksheet
Dim wsTxt As Worksheet
Dim numRNG As Range
FPtt = Range("A12").Value
fPath = "" & CStr(FPt) & "\"
fName = "" & CStr(FPt) & "\req_val.txt"
Windows("cst.xls").Activate
Set wsRaw = Sheets("Sheet1")
Set numRNG = wsRaw.Range("A:A").SpecialCells(xlConstants, xlNumbers)
Set wsTxt = Sheets.Add(After:=Sheets(Sheets.Count))
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & fName, Destination:=wsTxt.Range("A1"))
.Name = "req_val"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
' Getting problem in the below line as Invalid procedure call or argument
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = True
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = True
.TextFileColumnDataTypes = Array(1)
' Getting the error if I comment the above error line: Object doesn't support this property or method
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With
End Sub
Any correction required in the above code?
Bookmarks