Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Feb 2007
    Location
    Vienna, Wien, Austria
    Posts
    126
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi all,

    I found a Utility where I can select files in a listbox. In the original utility it is possible to open all of the selected workbooks.
    I adopted it a little bit for my utility to import the selected files in the listbox, which makes a third case to import files (case A - all files in selected
    folder are imported, case B - the files, selected with an x are imported). Case C should be that the files in the listbox will be imported... thats the problem now for me, because I tried to use some code from case B, with no solution. Furthermore in case C the number of files to import must be calculated too - for my progress indicator. Any help would be appreciated...

    stef
    Attached Files Attached Files

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    I'd write the list of files to the parameter sheet, and place an "x" if the corresponding item is selected in the list box. You can then use method B without having to write new code.

  3. #3
    2 Star Lounger
    Join Date
    Feb 2007
    Location
    Vienna, Wien, Austria
    Posts
    126
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok, that would be a very useful solution, but how to write the list from the listbox into the parametersheet?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Code:
    Private Sub CommandButton1_Click()
      Dim wsh As Worksheet
      Dim r As Long
      Set wsh = Worksheets("parameter")
      wsh.Range("C15:E65536").ClearContents
      For r = 0 To Me.lstBook1.ListCount - 1
    	wsh.Cells(r + 15, 3) = Me.lstBook1.List(r)
    	If Me.lstBook1.Selected(r) Then
    	  wsh.Cells(r + 15, 5) = "x"
    	End If
      Next r
      Unload Me
    End Sub

  5. #5
    2 Star Lounger
    Join Date
    Feb 2007
    Location
    Vienna, Wien, Austria
    Posts
    126
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='797503' date='12-Oct-2009 16:48']
    Code:
    Private Sub CommandButton1_Click()
      Dim wsh As Worksheet
      Dim r As Long
      Set wsh = Worksheets("parameter")
      wsh.Range("C15:E65536").ClearContents
      For r = 0 To Me.lstBook1.ListCount - 1
    	wsh.Cells(r + 15, 3) = Me.lstBook1.List(r)
    	If Me.lstBook1.Selected(r) Then
    	  wsh.Cells(r + 15, 5) = "x"
    	End If
      Next r
      Unload Me
    End Sub
    [/quote]
    ok, I put Your code into thze procedure, but something strange happens: it is importing the non selected files.
    is it possible to put an x, when it is importing the selected files.

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    That must be a problem with the existing code, so you should be able to work that out yourself.

Posting Permissions

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