Results 1 to 3 of 3

Thread: How to Receive an array? *resolved*

Threaded View

  1. #1

    Thread Starter
    Member superfrog80's Avatar
    Join Date
    Aug 2003
    Location
    Ma-Lai-Xi-Ya
    Posts
    32

    How to Receive an array? *resolved*

    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...
    VB Code:
    1. Option Explicit
    2. Private Sub cmdLoadFile_Click()
    3. Dim strLoadFile As String
    4.     strLoadFile = Application.GetOpenFilename("CSV Files (*.csv),*.csv,All Files (*.*),*.*", , "Open")
    5.     If strLoadFile <> "False" Then
    6.         Application.Workbooks.Open strLoadFile
    7.         ThisWorkbook.Sheets("Chart1").Activate
    8.         ThisWorkbook.Sheets("Chart1").ChartObjects(1).Activate
    9.         ActiveChart.SetSourceData Source:=Workbooks(2).Sheets(1).Range("a1:a10"), PlotBy:=xlColumns
    10.    End If
    11. End Sub
    any and all input/comments readily welcome..
    ;p
    Last edited by superfrog80; Oct 13th, 2003 at 07:54 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width