Code Snippet

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
Option Explicit

'批量转换文件夹中的xls为csv

Sub covertFile(ByRef sFilename As String)
Dim oWorkbook As Workbook
Set oWorkbook = Workbooks.Open(Filename:=sFilename)
oWorkbook.SaveAs Filename:
=sFilename & ".csv", FileFormat:= _
xlCSV, CreateBackup:
=False
oWorkbook.Close
False
End Sub

Sub covertFiles()
Dim sPath As String
Dim sDir As String
sPath
= "K:\Desktop\List"
sDir
= Dir(sPath & "\*.xls")
While Len(sDir)
Debug.Print sDir
covertFile sPath
& "\" & sDir
sDir
= Dir
Wend
End Sub

 

posted on 2010-07-06 13:03  kmlxk  阅读(1676)  评论(0)    收藏  举报