CodePudding user response:
Choose file oneself do a form, will file read into listbox, listbox checkbox mode choice;
Private Sub CommandButton1_Click ()
Dim As Integer I
For I=0 To ListBox1. ListCount - 1
If ListBox1. Selected (I) Then
MsgBox ListBox1. List (I)
End the If
Next
End Sub
Private Sub UserForm_Initialize ()
Dim fso As Object
The Set of fso=CreateObject (" scripting. Filesystemobject ")
Dim objfolder As Object
The Set objfolder=fso. Getfolder (" D: \ my documents \ documents ")
Dim objfile As Object
For Each objfile In objfolder. Files
If LCase (fso) getextensionname (objfile. Name))="XLSM" Then
ListBox1. AddItem objfile. Name
End the If
Next
End Sub
Run the example:
Download address:
Link: https://pan.baidu.com/s/1YcH7TfL0QKafBhwVcrvw8A
The extracted code: kwka
If your request is too general, but you can refer to this post:
Ask: how can you put the number of fixed format EXCEL part extracted into a working table?
https://bbs.csdn.net/topics/392569858