Auto Importing a macro

  • Thread starter Thread starter NikRoberts
  • Start date Start date
N

NikRoberts

Hi,

I have been doing some work in UNIX. The results come out as a large
..csv text file (delimited by a comma).

To look at the results I like to import it into EXCEL. When I get into
Excel I have to format the report alot so I craeted a macro which I can
run each time. Still no problem.

Because the csv file changes regularly this means the macro has to
change so I decided to create the macro's visual basic commands
automatically whilst doing my work in UNIX and store them in a text
file (macrofile.txt).

Everythings still going well and now I can manually open the .csv in
EXCEL and manually import the macrofile.txt into the Visual Basic
editor and then run it. Thats great manually.

So my question is how can I automate the openning of the .csv with the
macrofile.txt and then run the macrofile? (Tried recording my actions
of imprting the macro but it does not work - as you can see I'm pretty
new to this).

Please please help.

Nik
 
I'd do it this way:

Start a new workbook, bring in your macro code into a General module.

Now back to Excel and show the Forms toolbar.

Click on the button icon and draw a button on the worksheet. When you finish,
you'll be prompted to assign a macro to your button. Choose the macro you just
added.

Save this workbook.

Now when you want to import that text file, just open this "helper" workbook.

Click the big button and your macro will run.
 
Back
Top