ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Link to text file (https://www.excelbanter.com/excel-discussion-misc-queries/144656-link-text-file.html)

Chris

Link to text file
 
I am looking to link to data saved within a text file using excel. How can I
do this?

Mike H

Link to text file
 
Chris,

What do you actually want to do? Reading from or writing to a text file is
something Excel can do, for eaxmple the code below reads in 1 line at a time
from a text file and copies it to a worksheet.

Sub importtext()
x = 1
Open "c:\trial.txt" For Input As #1
Do While Not EOF(1)
Input #1, Line
Worksheets("sheet1").Cells(x, 1).Value = Line
x = x + 1
Loop
Close #1
End Sub

Mike

"Chris" wrote:

I am looking to link to data saved within a text file using excel. How can I
do this?


Chris

Link to text file
 
Hi Mike,

The text file is a report which contains telephone data. I need to take the
total number of calls received and answered from the file, and the date which
is in the file. The rest of the text in the file I don't need. Is there any
way of doing this with a formula as unfortunately I don't understand macro
coding.

Thanks for your help.
Chris

"Mike H" wrote:

Chris,

What do you actually want to do? Reading from or writing to a text file is
something Excel can do, for eaxmple the code below reads in 1 line at a time
from a text file and copies it to a worksheet.

Sub importtext()
x = 1
Open "c:\trial.txt" For Input As #1
Do While Not EOF(1)
Input #1, Line
Worksheets("sheet1").Cells(x, 1).Value = Line
x = x + 1
Loop
Close #1
End Sub

Mike

"Chris" wrote:

I am looking to link to data saved within a text file using excel. How can I
do this?



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com