CSV and Macros


Posted by Chris on August 16, 2001 11:26 AM

I am currently creating a csv formatted file to get
data in Excel, however as you might imagine, the data
is ugly looking. I can create a macro to beautify
things and even make a chart, but how can I get a
text version of this macro to load and run automatically
when the csv file is opened? The user opening the
file may not have the macro locally. Can it be included
somehow?

Posted by Mark W. on August 16, 2001 11:29 AM

Embed Excel Macro 4.0 language into your CSV file,
but is still wouldn't execute on open. Your user
would have to fire it off.

Posted by Chris on August 16, 2001 12:21 PM

Is there a trick to imbedding it or can I just
paste the text at the end of the csv file? Thanks
for the reply btw :)



Posted by Mark W. on August 16, 2001 2:37 PM

Take a look at this example...

...save a CSV file, and then open it and run.

Start macro here (Alt+F8),,,,
=ECHO(FALSE),,,,
"=OPTIONS.VIEW(,,,,,,FALSE)",,Jan,Feb,Mar
"=SELECT(""C2,R3"")",Apples,10,40,70
"=FORMAT.FONT(,,TRUE)",Oranges,20,50,80
"=SELECT(""R7C2,R3C6"")",Lemons,30,60,90
"=FORMULA.FILL(""TOTAL"")",,,,
"=SELECT(""R7C3:R7C6"")",,,,
"=FORMULA.FILL(""=SUM(R[-1]C:R[-3]C)"")",,,,
"=SELECT(""R4C6:R6C6"")",,,,
"=FORMULA.FILL(""=SUM(RC[-3]:RC[-1])"")",,,,
"=SELECT(""C1"")",,,,
=COLUMN.WIDTH(0),,,,
=RETURN(),,,,