
Originally Posted by
abdelfattah
arnelgp
I didn't say there is error!
it doesn't open any file when click selected from listbox whether excel or pdf files.
maybe because of this code in UserForm_Initialize() sub:
Private Sub UserForm_Initialize()
' Set a default folder path when the UserForm initializes
' This will default to the user's Desktop folder.
Me.TextBox1.Text = Environ("USERPROFILE") & "C:\Users\pc\Desktop\data"
Me.Label1.Caption = "Files Found: 0" ' Reset count
Me.ListBox1.Clear ' Clear any previous list
End Sub
If should be:
Private Sub UserForm_Initialize()
' Set a default folder path when the UserForm initializes
' This will default to the user's Desktop folder.
Me.TextBox1.Text = Environ("USERPROFILE") & "\Desktop\data"
Me.Label1.Caption = "Files Found: 0" ' Reset count
Me.ListBox1.Clear ' Clear any previous list
End Sub