#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 96
Default Import data

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




  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default Import data

Delete the QueryTable when the macro is ready

Something like this

ActiveSheet.QueryTables(1).Delete


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"chrisnsmith" wrote in message ...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
import XML data...Is there a size limit on the import? MatthewG Excel Discussion (Misc queries) 0 February 10th 09 05:57 PM
How to Start Excel in Text Import Wizard for data import rlelvis Setting up and Configuration of Excel 0 July 10th 08 08:40 PM
Import external data, data includes Excel function allen davidson Excel Worksheet Functions 0 July 4th 08 12:39 PM
Prevent equation from skipping data when referencing import data? lybrt98 Excel Discussion (Misc queries) 0 August 30th 05 05:01 PM
how to Import data in excel office2003 with data more 65000 rows Abhijit Excel Worksheet Functions 1 May 13th 05 05:12 AM


All times are GMT +1. The time now is 07:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"