• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Workbook open from userform selection.

Belleke

Well-Known Member
I fill a userform listbox with this code
Code:
MyFolder = ThisWorkbook.Path & "\Attendance"
MyFile = Dir(MyFolder & "\*.xlsm")
Do While MyFile <> ""
    LB1.AddItem MyFile
    MyFile = Dir
Loop
LB1 is a the listbox
Attendance is the folder
Then I use this to open a workbook.
Code:
Private Sub LB1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
  Workbooks.Open ThisWorkbook.Path & "\Attendance" & "\ " & LB1
    Unload Me
End Sub
I get an error msg, it keeps on saying Could not find file .....
What am I missing
 
vletm,
Yes, I tryed a few different ways, no luck:(
How would you solve it to open a xslm file from a userform textbox?
 
Belleke
... few different ways ... hmm?
Isn't there only one way .. take spaces away - or how?

Next, I would check value of
ThisWorkbook.Path & "\Attendance" & "\ " & LB1
Is it something which it should be?
Especially, LB1 ... maybe something is missing?
 
Hmm...
I still wondering ...
You wrote: Yes, I tryed a few different ways, no luck:(
What did You then?
 
Back
Top