#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Import Data

I am creating a macro that imports data using;

Application.ScreenUpdating = False
With Selection.QueryTable
.Connection = _
"TEXT;C:\path\file."
BackgroundQuery:=True

Application.ScreenUpdating = True

It works perfect except that I have to manually input the
path and file name each time it runs i.e it stops and
shows the input dialog box.

I want it to do this automatically. It knows the path
and file name, yet asks for it.

As you can see I have used Application.ScreenUpdating =
False and changed BackgroundQuery:= to True.

Any ideas how to make this run w/o user input?

Thanks for any help or suggestions.

Regards

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 134
Default Import Data

hi,
on the line "text;C:\Path\file.". I think this was ment to
be general. I think whoever wrote this ment for the user
to fill in the complete file path. So delete Path\file and
type in the correct file path and file name. should work
then.

-----Original Message-----
I am creating a macro that imports data using;

Application.ScreenUpdating = False
With Selection.QueryTable
.Connection = _
"TEXT;C:\path\file."
BackgroundQuery:=True

Application.ScreenUpdating = True

It works perfect except that I have to manually input the
path and file name each time it runs i.e it stops and
shows the input dialog box.

I want it to do this automatically. It knows the path
and file name, yet asks for it.

As you can see I have used Application.ScreenUpdating =
False and changed BackgroundQuery:= to True.

Any ideas how to make this run w/o user input?

Thanks for any help or suggestions.

Regards

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Import Data

I think it asks you because the connection path isn't valid. it looks like
it's missing the file extension.

your connection path should contain the "full path" of the text file your
querying
.Connection = "TEXT;C:\path\file.txt"
or
.Connection = "TEXT;C:\path\file.csv"

also, in your code, i didn't see a End With statement. be sure it's in your
actual code.


Matt
Blue Ridge Telecom

"Ronbo" wrote:

I am creating a macro that imports data using;

Application.ScreenUpdating = False
With Selection.QueryTable
.Connection = _
"TEXT;C:\path\file."
BackgroundQuery:=True

Application.ScreenUpdating = True

It works perfect except that I have to manually input the
path and file name each time it runs i.e it stops and
shows the input dialog box.

I want it to do this automatically. It knows the path
and file name, yet asks for it.

As you can see I have used Application.ScreenUpdating =
False and changed BackgroundQuery:= to True.

Any ideas how to make this run w/o user input?

Thanks for any help or suggestions.

Regards


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

If you want to use an existing querytable, change the connection string,
then refresh the querytable.

Otherwise, delete the old querytable and create a new one.

--
Regards,
Tom Ogilvy


"Ronbo" wrote in message
...
I am creating a macro that imports data using;

Application.ScreenUpdating = False
With Selection.QueryTable
.Connection = _
"TEXT;C:\path\file."
BackgroundQuery:=True

Application.ScreenUpdating = True

It works perfect except that I have to manually input the
path and file name each time it runs i.e it stops and
shows the input dialog box.

I want it to do this automatically. It knows the path
and file name, yet asks for it.

As you can see I have used Application.ScreenUpdating =
False and changed BackgroundQuery:= to True.

Any ideas how to make this run w/o user input?

Thanks for any help or suggestions.

Regards



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:54 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"