Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Changing only source file of pre-existing text import QueryTable?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Changing only source file of pre-existing text import QueryTable?

right click on the query in the worksheet and choose to edit the query.

Turn the macro recorder on while you do it manually if you are looking for
code.

--
Regards,
Tom Ogilvy

"EBrowne" wrote in message
...



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Changing only source file of pre-existing text import QueryTab

Hey, thanks for the reply. My long post got cut, it seems. I've written a
very long, involved macro that imports data from hundreds of data files.
Unfortunately, I've got multiple formats, including fixed width columns, and
I need to excerp various numbers of rows and columns. Unfortunately, the top
row is not always the labels row, and the labels often have spaces in them,
so using spaces as a delimiter in fixed column formats screws up the labels.

So instead of hard-wiring the data import into my code, I would like to
change the queries in the template, and then simply change the data file
source with the code.

However, when I change the .Connection property, it blanks out all the other
settings
in the querytable definitions. I've watched them go blank in the locals
window. And when I change the .SourceDataFile, it has no effect on the
..Connection property, so the same default file keeps being imported.

Any ideas?
"Tom Ogilvy" wrote:

right click on the query in the worksheet and choose to edit the query.

Turn the macro recorder on while you do it manually if you are looking for
code.

--
Regards,
Tom Ogilvy

"EBrowne" wrote in message
...




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Changing only source file of pre-existing text import QueryTab

I can't say about your other properties, but you have to change the
connection property and the sql property.

I'm using Excel 97, so I don't have a sourcedatafile property.

Maybe you just want to record creating your querytable, then generalize the
code so you can feed different arguments to it. Delete the table between
each creation. That will record setting the properties.

--
Regards,
Tom Ogilvy


"EBrowne" wrote in message
...
Hey, thanks for the reply. My long post got cut, it seems. I've written

a
very long, involved macro that imports data from hundreds of data files.
Unfortunately, I've got multiple formats, including fixed width columns,

and
I need to excerp various numbers of rows and columns. Unfortunately, the

top
row is not always the labels row, and the labels often have spaces in

them,
so using spaces as a delimiter in fixed column formats screws up the

labels.

So instead of hard-wiring the data import into my code, I would like to
change the queries in the template, and then simply change the data file
source with the code.

However, when I change the .Connection property, it blanks out all the

other
settings
in the querytable definitions. I've watched them go blank in the locals
window. And when I change the .SourceDataFile, it has no effect on the
.Connection property, so the same default file keeps being imported.

Any ideas?
"Tom Ogilvy" wrote:

right click on the query in the worksheet and choose to edit the query.

Turn the macro recorder on while you do it manually if you are looking

for
code.

--
Regards,
Tom Ogilvy

"EBrowne" wrote in message
...






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
Bar width on existing chart changes when changing source data Robert Brown Charts and Charting in Excel 5 April 30th 10 07:18 PM
import data from txt file to an existing excel file shaji Excel Discussion (Misc queries) 1 September 12th 09 04:15 PM
import data into existing excel file Erik Excel Discussion (Misc queries) 0 January 15th 09 03:55 PM
import info from outlook to existing excel file elliec Excel Worksheet Functions 3 June 29th 06 09:45 AM
Using Querytable.add to import data from a closed workbook Markus Stolle[_5_] Excel Programming 8 August 3rd 04 08:51 PM


All times are GMT +1. The time now is 12:19 AM.

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

About Us

"It's about Microsoft Excel"