title: Excel, subscript out of range
body: <p>I have read probably everysingle post on the internet but can't make it work.</p>
  
  <p>I have created a form that has (1) ListBox control and (1) Excel spreadsheet control. That s it. What i am trying to accomplish is to be able to browse the excel workbooks inside the spreadsheet control. </p>
  
  <p>I have the list populated already from an specific folder in the network, I was also able to dump the data to the spreadsheet control but only from the "Active Workbook. and this is the problem. I need to activate diferent workbooks as I click on the listbox. See below my code for the listbox.Click(). I am getting the error message here "Workbooks(workbooknow).Activate". i have make sure that the file extensions are correct and that the file names are correct also, confirmed with debug.</p>
  
  <p>Private Sub ListBox1_Click()</p>
  
  <pre><code>Dim p_wsSheet As Worksheet
  Dim p_rnData As Range
  Dim p_owcSpread As OWC11.Spreadsheet
  Dim workbooknow As String
  Dim fPath As String
  
  workbooknow = ListBox1.Text
  
  Workbooks(workbooknow).Activate
  
  
  
  Set p_wsSheet = ActiveSheet
  Set p_rnData = p_wsSheet.Range("A1:N300")
  
  Set p_owcSpread = Me.Spreadsheet1
  
  With p_owcSpread
       'Populate a range.
      With .ActiveSheet
          .Range("A2:N300").Value = p_rnData.Value
      End With
       'Limit the range to be viewed in the control.
      With .ActiveWindow
          .ViewableRange = "A1:N300"
      End With
  End With
  
  Set p_owcSpread = Nothing
  </code></pre>
  
  <p>End Sub</p>
  
  <p>This is how I get the List Populated in the listbox</p>
  
  <p>Private Sub UserForm_Initialize()</p>
  
  <pre><code>Dim filelist() As String
  Dim fname As String
  Dim fnameActivation As String
  Dim fPath As String
  Dim I As Integer
  
  
  
   'define the directory to be searched for files
  
  fPath = "X:\ESTIMATINGSOLUTIONS\"
  
   'build a list of the files
  fname = Dir(fPath &amp; "*.xlsx")
  While fname &lt;&gt; ""
       'add fName to the list
      I = I + 1
      ReDim Preserve filelist(1 To I)
      filelist(I) = fname
  
     ' Workbooks(fname).Activate
       'get next filename
      fname = Dir()
  
  Wend
   'see if any files were found
  If I = 0 Then
      MsgBox "No files found"
      Exit Sub
  End If
   'cycle through the list and add to listbox
  For I = 1 To UBound(filelist)
      Me.ListBox1.AddItem filelist(I)
  Next
  </code></pre>
  
  <p>End Sub</p>
  
  <p>I wonder if this error message come from the " file path" at the time of making active the workbook. Any help here.</p>