View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Input data from file to Excel in Column Format

Turn on the macro Recorder

Tools=Macros=Record a Macro

then open the file manually and go through the Text import wizard.

turn off the macro recorder.

You might have to rename the file to have a .txt extension to do it
manually, but I think it will work without that.

Now look at the recorded code.

Alter to suit your needs.

See help on the OpenText method.

--
Regards,
Tom Ogilvy


"Nuc" wrote in message
...

Hey everyone I'm new to VB and need some help.

I'm trying to input a file from a .dat file (output from Fortran code).
The .dat file contains multiple column such as:
---------
2 5.48564954E+05 4.07889292E+06 5.47506020E+05 4.07922513E+06
3 5.48560812E+05 4.07880932E+06 5.47497497E+05 4.07914291E+06
4 5.48556669E+05 4.07872573E+06 5.47488975E+05 4.07906069E+06
5 5.48552526E+05 4.07864214E+06 5.47480453E+05 4.07897847E+06
6 5.48548383E+05 4.07855855E+06 5.47471931E+05 4.07889625E+06
7 5.48544240E+05 4.07847495E+06 5.47463408E+05 4.07881404E+06
8 5.48540097E+05 4.07839136E+06 5.47454886E+05 4.07873182E+06
9 5.48535954E+05 4.07830777E+06 5.47446364E+05 4.07864960E+06
10 5.48531811E+05 4.07822417E+06 5.47437842E+05 4.07856738E+06