Home > Software engineering >  Excel bulk import excel
Excel bulk import excel

Time:03-03

Code is used to implement a open an excel file, please let the batch you choose you need to import the XSLX suffix file and create a new excel file these choices of the summary of the contents of the documents, the selection of the file format is the same

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
  •  Tags:  
  • VBA
  • Related