Automating charts from a csv file

  • Thread starter Thread starter erman
  • Start date Start date
E

erman

Hello,
ons of our softwares creates some csv file everyday.
Is there a way to create charts automatically via excel from this csv file?
Thank you
Erman Ulusoy
 
Erman -

Sure, this is actually fairly easy to do. Start by recording a macro:

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 2/27/2004 by Jon Peltier
'
'
Workbooks.Open FileName:= _
"\\holy\cow\where\is\that\file\Y03\M04\03040109CW.csv"
Charts.Add
ActiveChart.ChartType = xlXYScatterLinesNoMarkers
ActiveChart.SetSourceData _
Source:=Sheets("03040109CW").Range("A22:E48")
ActiveChart.Location Where:=xlLocationAsObject, Name:="03040109CW"
End Sub

Now add features like a GetOpenFileName dialog to allow the user to
select the file, or something that gets a file which has today's date
embedded in its filename. And something that detects whether the source
data range is larger or smaller than normal. And special formatting that
your chart may need.

I do this all the time, and my coworkers are always amazed. I guess I've
never let on how easy it is.

- Jon
 
Back
Top