Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default Import Text File Window Bypass

I have a macro set up to refresh a delimited .txt file import. However, I
continue to receive the "Import Text File" prompt box and have to select the
file. I would like to bypass this prompt all together by specifying the name
of the file. The guts of the code are below:

With Selection.QueryTable
.Connection = _
"TEXT;J:\Office Records\1 Central Reports and Projects
Folder\Dashboard\Source_files\Presidential Sales violations.txt"
.Refresh BackgroundQuery:=False
End With

I've also tried the .Connection with "TEXT;" & "J:...." and come up with the
same issue - so there must be something I'm doing wrong in calling the file
name. Can someone assist me with this issue?

Thanks,
Todd

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,346
Default Import Text File Window Bypass

Hi,

Why not dispense with the Import macro and create a live connection to the
text file, then when you want to refresh you can just choose Data, Refresh
Data. It takes a little time to set it up the first time, but after that
there's nothing to updating.

Here is the basic idea:

1. Choose Data, Import External Data, New Database Query
2. With New Data Source selected click OK, enter any name you want and open
the second drop-down and choose Microsoft Text Driver (*.txt, *.csv) and
click Connect.

The steps in here depend on where the file is located. But what you are
doing is finding and selecting the file.

6. Double-click each field you want or click the while selecting the table
name, if you want all the fields.
7. Click Next. This screen allows you to filter the record being returned
before they reach Excel.
8. Click Next. This screen allows you to sort the data before returning it
to Excel, probably little point in doing this.
9. Click Next. Choose Return data to Microsoft Office Excel and click Finish.
10. Choose a location for the linked data and click OK.

To refresh the data either choose Data, Refresh Data or click the Refresh
All button if you have it displayed.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"tmwilkin" wrote:

I have a macro set up to refresh a delimited .txt file import. However, I
continue to receive the "Import Text File" prompt box and have to select the
file. I would like to bypass this prompt all together by specifying the name
of the file. The guts of the code are below:

With Selection.QueryTable
.Connection = _
"TEXT;J:\Office Records\1 Central Reports and Projects
Folder\Dashboard\Source_files\Presidential Sales violations.txt"
.Refresh BackgroundQuery:=False
End With

I've also tried the .Connection with "TEXT;" & "J:...." and come up with the
same issue - so there must be something I'm doing wrong in calling the file
name. Can someone assist me with this issue?

Thanks,
Todd

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
Set Defaults in File Import of a Text File Dkline Excel Worksheet Functions 2 January 28th 08 06:20 PM
How to import text file into one column Jeff[_4_] Excel Discussion (Misc queries) 4 October 20th 07 03:15 PM
import from text file jason2444 Excel Discussion (Misc queries) 2 January 17th 07 04:22 PM
Would Like to Automate Batch File Creation and Text FIle Import socrtwo Excel Discussion (Misc queries) 2 August 18th 06 03:54 PM
Bypass prompt to open XML file as XML list? Steve Vincent Excel Discussion (Misc queries) 0 March 13th 06 10:05 PM


All times are GMT +1. The time now is 10:28 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"