C
chrisnsmith
I recorded the attached macro for importing data into my worksheet in range
A6:E700. However when I try to run it on reopening my workbook I get a
highlight in the debugger at this line.
..Refresh BackgroundQuery:=False
Can someone tell me what I'm doing wrong?
Sub Import() Workbooks.Add
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\chris\My Documents\Wednesday
Positions.txt", _
Destination:=Range("A1"))
.Name = "Wednesday Positions"
.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 = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(10, 5, 10, 16)
.Refresh BackgroundQuery:=False---> This line is always highlighted.
End With
Range("A1:E718").Select
Selection.Copy
Windows("Wednesday Report.xls").Activate
ActiveSheet.Paste
End Sub
A6:E700. However when I try to run it on reopening my workbook I get a
highlight in the debugger at this line.
..Refresh BackgroundQuery:=False
Can someone tell me what I'm doing wrong?
Sub Import() Workbooks.Add
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\chris\My Documents\Wednesday
Positions.txt", _
Destination:=Range("A1"))
.Name = "Wednesday Positions"
.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 = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1)
.TextFileFixedColumnWidths = Array(10, 5, 10, 16)
.Refresh BackgroundQuery:=False---> This line is always highlighted.
End With
Range("A1:E718").Select
Selection.Copy
Windows("Wednesday Report.xls").Activate
ActiveSheet.Paste
End Sub