MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Excel and DOS

Posted by Cliff on September 02, 2000 11:33 PM

I've been told this isn't possible but I thought I'd ask people I trust. Is there any way for an Excel file to automatically read from a DOS file? I have a file and am currently updating the figures manually but would like to have it do it itself. Anyway possible?

Thanks in advance,

Posted by Ivan Moala on September 07, 0100 1:15 AM

Just as an added note for your programmers and
You can get the data via VBA by
1) Using Sequential File access
Access Reading Files Opened for Sequential Access Writing to Files Opened for Sequential Access·
2)Using Random Access Reading Files Opened for Random AccessWriting to Files Opened for Random Access
3)Using Binary Access Opening Files For Binary AccessWriting to Files Opened for Binary AccessReading Files Opened For Binary Access

Each method has its points for and against and
it depends on what you want to accomplish ie.
define the task and then go from there.


Posted by Ivan Moala on September 03, 0100 1:28 AM

Thanks in advance,

Yes this is possile, if I understand you correctly
then you want to read a Dos file (read ANSII).
An example of this would be,

Sub GetInput_File()
Dim Data
Dim x As Integer

Open "c:\Autoexec.bat" For Input As #1

Do While Not EOF(1)
Line Input #1, Data
Cells(x + 1, 1) = Data
x = x + 1

End Sub

To automate this ......well there are a number of
ways eg.
1) Timed
2) attachd to a command button

Having got the data you probably need to get it
into some format ad then search for the data you
want ???


Is this what you were after ???


Posted by Cliff on September 06, 0100 9:44 PM

Thanks in advance, Cliff


I think so, I will need to disect what you wrote but I'm glad there is a way. I am on a network at work and the company programmers are who said there was no way to do it. But I may be back when I find out all the files I will need to connect, I will need to pursuade the programmers since I will need to access the autoexec file which they will probably crap their pants just for me asking. But thank you for your reply if I can't get them to let me at least I can learn how to do it on my own.