Software tools: excel 20 13
1. Organize all Excel files to be converted into a folder. Create a new folder to save the converted folder.
2. Create a new Excel workbook and click "Development Tools" on the menu bar; Click the ribbon to open Visual Basic.
3. If there is no development tool on the menu bar, click the file pop-up menu to select an option. In EXCEL options, click the custom ribbon, select the development tool on the right, and then click OK.
4. Double-click Sheet 1 in the left project browser to open the code window. If the Project Browser is not displayed, press ctrl+R to display it.
5. Enter the following code, where fPath = ""is the file source path. SPath = ""is the save path; The path needs to end with \.
Sub? SaveToCSVs()
Dim? fDir? As? line
Dim? wB? As? exercise book
Dim? wS? As? worksheet
Dim? fPath? As? line
Dim? Spath? As? line
fPath? =? “C:\Users\qiany\Desktop\ file”
Spath? =? "C:\Users\qiany\Desktop\csv save location \"
fDir? =? Directory (path)
Do what? What time? (fDir? & lt& gt? "")
What if? Right (fDir,? 4)? =? ".xls "? Or? Right (fDir,? 5)? =? ".xlsx”? then
Open? Mistakes? Resume? then
Settings? wB? =? Workbooks. Open (fPath? & amp? fDir)
MsgBox? (wB。 Name)
For what? Every one? wS? Are you online? wB。 worksheet
wS。 SaveAs? Spath? & amp? wB。 Name? & amp? ".csv ",xlCSV
Next? Washington star
wB。 Close? wrong
Settings? wB? =? Nothing
End? if
fDir? =? catalogue
Open? Mistakes? GoTo? 0
ring
End? Sub6, write the code and start running. Click Run on the menu bar and select Run Sub-process/User Form.
7. Click Run.
8. Start the conversion process. During this process, multiple EXCEL tables are automatically displayed and then closed. When finished, open the settings saving folder, and you can see the converted CSV file.
Precautions:
1, fPath = "\ ",sPath = "\" needs to be in \
2. The program saves each worksheet as a CSV file. If there are multiple worksheets in a workbook, multiple CVS files will be generated.