Option Explicit
Function getAllFolderAndFiles(ByVal strPath As String, Optional ByRef r As Double = 1)
Dim f As Object
Dim fso As New FileSystemObject
For Each f In fso.GetFolder(strPath).Files
Sheet1.Cells(r, 1).Value = f.Path
r = r + 1
Next
For Each f In fso.GetFolder(strPath).SubFolders
getAllFolderAndFiles f.Path, r
Next
End Function
Function ReadTxtFile(ByVal inPath As String)
'2バイト文字の読み方
'Dim fso As New FileSystemObject
'MsgBox fso.OpenTextFile(inPath).ReadAll
'需要引入 ActiveX Data Objects(ADO)组件,无论是前期引用还是后期引用均需
'即 Microsoft ActiveX Data Objects 2.5 Library 或者 Microsoft ActiveX Data Objects 2.6 Library
'漢字入れの読み方
With CreateObject("ADODB.Stream")
.Type = 2 'adTypeText
.Charset = "UTF-8"
.Open
.LoadFromFile inPath
MsgBox .ReadText
.Flush
.Close
En
VBA常用方法记录一二
最新推荐文章于 2022-04-07 21:11:11 发布