Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Extra ranges

When I get external data using the code below, a new range name is created
each time I bring in the data. The name refers to the external data file and
just keeps incrementing the range name by 1 so the range names aren't
duplicates. Am I doing something wrong when I get the external data? Even
if I comment out the .Name line I still get ExternalData_1, ExternalData_2,
etc. This problem's been nagging at me for quite some time. Help??? I
appreciate it!

Range("B3:C50").Select
Selection.ClearContents
Range("B3").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;S:\common\Excel Rewrites\Store Table BigM.txt",
Destination:=Range( _
"B3"))
' .Name = "Store Table BigM"
.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 = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1)
.Refresh BackgroundQuery:=False
End With
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Extra ranges

Can't you just refresh your existing table.

--
Regards,
Tom Ogilvy

"cottage6" wrote in message
...
When I get external data using the code below, a new range name is created
each time I bring in the data. The name refers to the external data file

and
just keeps incrementing the range name by 1 so the range names aren't
duplicates. Am I doing something wrong when I get the external data?

Even
if I comment out the .Name line I still get ExternalData_1,

ExternalData_2,
etc. This problem's been nagging at me for quite some time. Help??? I
appreciate it!

Range("B3:C50").Select
Selection.ClearContents
Range("B3").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;S:\common\Excel Rewrites\Store Table BigM.txt",
Destination:=Range( _
"B3"))
' .Name = "Store Table BigM"
.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 = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1)
.Refresh BackgroundQuery:=False
End With



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Extra ranges

Yes Tom, actually I could do that. Thanks. Sometimes I get carried away
trying to make things easier for users, but there's no reason they can't
refresh these tables.

"Tom Ogilvy" wrote:

Can't you just refresh your existing table.

--
Regards,
Tom Ogilvy

"cottage6" wrote in message
...
When I get external data using the code below, a new range name is created
each time I bring in the data. The name refers to the external data file

and
just keeps incrementing the range name by 1 so the range names aren't
duplicates. Am I doing something wrong when I get the external data?

Even
if I comment out the .Name line I still get ExternalData_1,

ExternalData_2,
etc. This problem's been nagging at me for quite some time. Help??? I
appreciate it!

Range("B3:C50").Select
Selection.ClearContents
Range("B3").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;S:\common\Excel Rewrites\Store Table BigM.txt",
Destination:=Range( _
"B3"))
' .Name = "Store Table BigM"
.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 = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1)
.Refresh BackgroundQuery:=False
End With




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Extra ranges

If you want code:

With ActiveSheet.QueryTables(1)
.Refresh BackgroundQuery:=False
End With

--
Regards,
Tom Ogilvy

"cottage6" wrote in message
...
Yes Tom, actually I could do that. Thanks. Sometimes I get carried away
trying to make things easier for users, but there's no reason they can't
refresh these tables.

"Tom Ogilvy" wrote:

Can't you just refresh your existing table.

--
Regards,
Tom Ogilvy

"cottage6" wrote in message
...
When I get external data using the code below, a new range name is

created
each time I bring in the data. The name refers to the external data

file
and
just keeps incrementing the range name by 1 so the range names aren't
duplicates. Am I doing something wrong when I get the external data?

Even
if I comment out the .Name line I still get ExternalData_1,

ExternalData_2,
etc. This problem's been nagging at me for quite some time. Help???

I
appreciate it!

Range("B3:C50").Select
Selection.ClearContents
Range("B3").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;S:\common\Excel Rewrites\Store Table BigM.txt",
Destination:=Range( _
"B3"))
' .Name = "Store Table BigM"
.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 = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1)
.Refresh BackgroundQuery:=False
End With






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
Extra Dates Greg[_6_] Charts and Charting in Excel 3 June 30th 09 02:18 PM
how copy formula that contains ranges so ranges do not overlap Patty Excel Worksheet Functions 1 November 20th 08 04:15 PM
about extra row jinvictor Excel Discussion (Misc queries) 1 June 7th 06 02:24 PM
named ranges - changing ranges with month selected gr8guy Excel Programming 2 May 28th 04 04:50 AM
extra space MAx Excel Programming 4 May 11th 04 04:37 PM


All times are GMT +1. The time now is 05:09 PM.

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"