ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Which function to use to open an .asc file? (https://www.excelbanter.com/excel-programming/305606-function-use-open-asc-file.html)

Real Name

Which function to use to open an .asc file?
 
Hi

Im writing a vba program to take the info from an asc file into
sheet2. I must use the xldelimited so the info goes into each column
properly and not just everything in one column ( it uses the comma to
determine the column).

The intention of the program is, in sheet1, a command button is used
to open a file window. The asc file is then selected bu the user, and
the data is to placed into sheet2. The asc file is no longer needed.
Calculations are made and shown in sheet1 using the data in sheet2.

The problem is Im not sure what function to use. Im thinking this
one:

object.OpenAsTextStream([iomode, [format]])

but cant get the above to work, because not too familiar with vba and
need help. The excel help example doesnt real show me.
Is there a website that has simple examples?

Thanks
Carlos


Myrna Larson

Which function to use to open an .asc file?
 
The Open and OpenText methods of the Workbooks object are probably what you
want. Both methods are described in Help, with examples.

Another way to get the syntax is to turn on the macro recorder and open the
file manually. Then stop the recorder and look at the macro code.


On Fri, 30 Jul 2004 23:32:23 -0400, Real Name wrote:

Hi

Im writing a vba program to take the info from an asc file into
sheet2. I must use the xldelimited so the info goes into each column
properly and not just everything in one column ( it uses the comma to
determine the column).

The intention of the program is, in sheet1, a command button is used
to open a file window. The asc file is then selected bu the user, and
the data is to placed into sheet2. The asc file is no longer needed.
Calculations are made and shown in sheet1 using the data in sheet2.

The problem is Im not sure what function to use. Im thinking this
one:

object.OpenAsTextStream([iomode, [format]])

but cant get the above to work, because not too familiar with vba and
need help. The excel help example doesnt real show me.
Is there a website that has simple examples?

Thanks
Carlos




All times are GMT +1. The time now is 11:32 PM.

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