Emyeuexcel
Thành viên thường trực




- Tham gia
- 9/6/16
- Bài viết
- 302
- Được thích
- 30
Chào anh chị em GPE,
Mình vô tình tìm thấy đoạn code sau để in nhiều file trong 1 thư mục, nhưng sao chạy code nó không in, và không báo gì
Mong anh chị em giúp mình sửa sao ah.
Rất cảm ơn anh chị!
Sub ListFilesInFolder()
Dim folderPath As String
Dim fileName As String
Dim fso As Object
Dim folder As Object
Dim file As Object
folderPath = "D:\TAM\IN\"
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FolderExists(folderPath) Then
Set folder = fso.GetFolder(folderPath)
For Each file In folder.Files
Debug.Print file.Name
Next file
Else
MsgBox "Folder does not exist!", vbExclamation
End If
Set file = Nothing
Set folder = Nothing
Set fso = Nothing
End Sub
Mình vô tình tìm thấy đoạn code sau để in nhiều file trong 1 thư mục, nhưng sao chạy code nó không in, và không báo gì
Mong anh chị em giúp mình sửa sao ah.
Rất cảm ơn anh chị!
Sub ListFilesInFolder()
Dim folderPath As String
Dim fileName As String
Dim fso As Object
Dim folder As Object
Dim file As Object
folderPath = "D:\TAM\IN\"
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FolderExists(folderPath) Then
Set folder = fso.GetFolder(folderPath)
For Each file In folder.Files
Debug.Print file.Name
Next file
Else
MsgBox "Folder does not exist!", vbExclamation
End If
Set file = Nothing
Set folder = Nothing
Set fso = Nothing
End Sub