I
ikirin
I get this error all the time. I ma trying to open bunch of DAT files
and stack tham in the excel sheet one after other. And i get this
message. When i am opening only one file it works fine, when i want to
do a for loop to go to the las file i specified it gives me this error
".Refresh BackgroundQuery:=False" Please Help. This is my code.
Private Sub CommandButton1_Click()
Dim intLastrow
Dim strFirstFileName
Dim intKiro
intLastrow = Cells(65536, 1).End(xlUp).Row
strFirstFileName = Application.GetOpenFilename
For intKiro = 0 To CInt(txtLastFileNumber.Text)
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" &
strFirstFileName, Destination:=Cells(intLastrow + 1, 1))
..Name = "BENT 2 -Final00" & intKiro
..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 = True
..TextFileSemicolonDelimiter = False
..TextFileCommaDelimiter = True
..TextFileSpaceDelimiter = False
..TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
..TextFileTrailingMinusNumbers = True
*.Refresh BackgroundQuery:=False*
End With
Next intKiro
End Sub
and stack tham in the excel sheet one after other. And i get this
message. When i am opening only one file it works fine, when i want to
do a for loop to go to the las file i specified it gives me this error
".Refresh BackgroundQuery:=False" Please Help. This is my code.
Private Sub CommandButton1_Click()
Dim intLastrow
Dim strFirstFileName
Dim intKiro
intLastrow = Cells(65536, 1).End(xlUp).Row
strFirstFileName = Application.GetOpenFilename
For intKiro = 0 To CInt(txtLastFileNumber.Text)
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" &
strFirstFileName, Destination:=Cells(intLastrow + 1, 1))
..Name = "BENT 2 -Final00" & intKiro
..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 = True
..TextFileSemicolonDelimiter = False
..TextFileCommaDelimiter = True
..TextFileSpaceDelimiter = False
..TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
..TextFileTrailingMinusNumbers = True
*.Refresh BackgroundQuery:=False*
End With
Next intKiro
End Sub