Excel programming / macro / VB

Associate
Joined
1 Dec 2002
Posts
1,884
Hi all,

Is it possible to create a macro/ VBscript to import data (with a fixed file name) into excel.

Something like Run macro "import X"

"imports file from C:\Temp\data.txt"
put break lines on 23 25 30 38 42.
label column A as "first column"
Column A format is data in YYYYMMDD change to DD/MM/YYYY

etc. or does it have to be imported manually? If its possible can you point me in the right direction.

Thanks in advance

noto
 
Just record a macro, use the import text file from the data menu -> get external data, format it as you wish then stop recording the macro.

It will probably be fine like that but any minor tweaking can be done in tools -> macro -> visual basic editor (the macro you just recorded will be on the left pane somewhere, module1 or something like that).
 
yeah, i did that in the end. I had a VERY bad experience before with that record function as it kept running out of space. (that time i had to string 17 macros together :S) must have been the way i did it.

Anyways I am sorted with that now. Thanks :) Although i have a new question which ill make a new topic about.
 
Back
Top Bottom