Hi!
I'm trying to code some macros in Excel 2k...
The basic idea is to open/load several *.csv files, then import the data into a chart...
I've been able to load a single *.csv file using the GetOpenFilename method...
but I'm having problems with opening multiple files...
I've set the MultiSelect argument in the GetOpenFilename method to "True", which allows me to select multiple files...
but how do i open all the files?
coz the GetOpenFilename returns the paths as an array...
... how do i store a "returned array"??
(currently, for the individual files, i store the string from GetOpenFilename, then use the Open method to open the *.csv file in another workbook.... is this a "stupid" way of doing it?... is there a more efficient way?)
anyway... here's my half-chewed code...
any and all input/comments readily welcome..VB Code:
Option Explicit Private Sub cmdLoadFile_Click() Dim strLoadFile As String strLoadFile = Application.GetOpenFilename("CSV Files (*.csv),*.csv,All Files (*.*),*.*", , "Open") If strLoadFile <> "False" Then Application.Workbooks.Open strLoadFile ThisWorkbook.Sheets("Chart1").Activate ThisWorkbook.Sheets("Chart1").ChartObjects(1).Activate ActiveChart.SetSourceData Source:=Workbooks(2).Sheets(1).Range("a1:a10"), PlotBy:=xlColumns End If End Sub
;p




Reply With Quote