Import Text File Into Existing Workbook Using VBA

Geth

New Member
Joined
Feb 11, 2005
Messages
3
HI

Does anyone know how to import a text file (semi colon delimited) into an existing workbook in VBA. The name of the existing workbook changes daily, however the filename & path of the file to be imported does not change.

The only version I know of (by recording a macro) opens the file in a new workbook :(
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Record a macro when you goto Data>Get External Data... Import Text File.

That should give you code to open the text file into an existing workbook.
 
Upvote 0
Unfortunately my version of excel (97) does not allow me to import a text file through that method.

It only allows the user to import by query or web or database etc
 
Upvote 0
Geth said:
Unfortunately my version of excel (97) does not allow me to import a text file through that method.

It only allows the user to import by query or web or database etc
Geth

I've used Chip's code successfully in XL97 to import a text file dropped on a server by our IT guys. The code opens a dialog box and the user changes directory/folder to find the file - thecode does the rest.
 
Upvote 0
Eeep, Sorry Glaswegian, I was responding to Norries post - I'll try the code later :)
 
Upvote 0
Geth

I thought that might be the case in 97.

Is there not an option under database query for text files?
 
Upvote 0

Forum statistics

Threads
1,203,521
Messages
6,055,882
Members
444,830
Latest member
Excelsmallbusinessmom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top