Hello,
I have a small problem when reffering to excel file in VBA code with its location on the disc. Basically I have a textbox in userform, where I paste path to particular exce file and I need to display the sheets name in ListBox.
This is the beggining o the code...
Private Sub TextBox1_Change()
Dim zosit As String
zosit = Sheets("druhy").Range("A1").Value
Sheets("druhy").Range("A1") = TextBox1.Text
End Sub
The problems appears to be in third line of this part, sice apparently, when trying to use variable "zosit" it will not locate the file...
Private Sub CommandButton1_Click()
Dim N As Long
With Workbooks.Open(fileName:="zosit")
For N = 1 To ActiveWorkbook.Sheets.Count
ListBox1.AddItem ActiveWorkbook.Sheets(N).Name
Next N
End With
End Sub
Thank you for your help...
Bookmarks