VB如何在多个文件夹中创建文本?
有多个文件夹,我想在每个文件夹中创建一个文本,文本的内容就是文本所在文件夹的路径,请问该如何写代码?谢谢
程序代码:
Private Sub Command1_Click() Path = App.Path Dim fso As FileSystemObject Dim fld As Folder Set fso = CreateObject("Scripting.FileSystemObject") Set fld = fso.GetFolder(Path) If fld.SubFolders.Count > 0 Then For Each f In fld.SubFolders sFile = f & "\t.txt" Open sFile For Output As #1 Print #1, f Close #1 DoEvents Next MsgBox ("OK") Else MsgBox ("该文件夹没有子目录") End If End Sub