2
我想使用VBA excel從文件夾將所有文件轉換爲dos爲unix格式。如何將文件從Dos轉換爲VBA中的Unix
我可以通過使用以下代碼找到驅動器中的所有文件。
Sub list_all_files(myFilepath As String, filecounter() As Variant, counter1 As Integer)
With Application.FileSearch
.NewSearch
.LookIn = myFilepath
.filename = "*.*"
counter = 0
If .Execute(SortBy:=msoSortByLastModified, SortOrder:=msoSortOrderDescending) > 0 Then
counter1 = .FoundFiles.Count
For i1 = 1 To .FoundFiles.Count
counter = counter + 1
filecounter(counter) = .FoundFiles(i1)
Next i1
End If
End With
End Sub
但如何轉換arrayof(文件)。我想將這些文件保存在相同的路徑上。
在此先感謝。
(1)'Application.FileSearch'已從xl07及以後版本棄用。你將運行一個遞歸的'Dir'或'FileStystemObject'例程來取代你的文件(2)我認爲這些都是'txt'文件,那麼爲什麼你要搜索'*。*'? – brettdj 2012-01-01 11:58:49