我有一些代码,我试图改善,但有一些问题。问题使用FileDialog应用程序
代码当前:
Sub TestListFilesInFolder()
'Workbooks.Add ' create a new workbook for the file list
' add headers
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFolderPicker) ' Tried using a FileDialog Application but had no luck
With Range("A1")
.Formula = "Folder contents:"
.Font.Bold = True
.Font.Size = 12
End With
Range("A3").Formula = "Old File Path:"
Range("B3").Formula = "File Type:"
Range("C3").Formula = "File Name:"
Range("D3").Formula = "New File Path:"
Range("A3:H3").Font.Bold = True
ListFilesInFolder "L:\Pictures\A B C\B526 GROUP", True
' ListFilesInFolder fd, True ' I tried replacing the above line with this line but get an error
' list all files included subfolders
End Sub
5号线和6是我在我试图得到一个文件对话框打开,用户可以选择文件夹的代码工作增加了一部分上。
此外,在底部起始ListFilesInFolder附近的注释掉的行是我尝试插入以替换它上面的行。
下一个代码位的起点是:
Sub ListFilesInFolder(SourceFolderName As String, IncludeSubfolders As Boolean)
所以它使用在第一子定义文件夹的文件和子文件夹。
任何帮助,将不胜感激。
问候,
山姆
嗨,谢谢你的回复。这工作完美。谢谢 – SCGB 2013-03-19 15:52:31
没问题 - 很高兴帮助。与您的项目的其余部分祝你好运。 – Sam 2013-03-19 16:04:50