ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   .Refresh BackgroundQuery:=False (https://www.excelbanter.com/excel-programming/365385-refresh-backgroundquery-%3Dfalse.html)

ikirin[_5_]

.Refresh BackgroundQuery:=False
 

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


--
ikirin
------------------------------------------------------------------------
ikirin's Profile: http://www.excelforum.com/member.php...o&userid=35599
View this thread: http://www.excelforum.com/showthread...hreadid=555612



All times are GMT +1. The time now is 02:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com