hi. good days,
how can i open a different path of the workbook in the listbox. if my listbox there only show the file name.
Private Sub btn_browse_Click()
Dim FileSelected As Variant
Dim filename
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
filePathA = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
If filePathA = "False" Then
filePathA = ""
Else
With ListBox1
.AddItem
.List(.ListCount - 1, 0) = FSO.GetFileName(filePathA)
.List(.ListCount - 1, 1) = filePathA
End With
End If
End Sub
if the workbook in different path, it will show the error. please help me. thanks
For Index1 = 0 To ListBox1.ListCount - 1
Set wbFrom = Workbooks.Open(ListBox1.List(Index1))
wb1 = ListBox1.List(Index1)
Next Index1
Bookmarks