تنها سایت آپلود عکس و فایل و آهنگ و فیلم رایگان و دائمی با لینک مستقیم و حجم بالا و بدون نیاز به ثبت نام و با ماندگاری مادام العمر آپلود سنتر عکس و فایل
__________________
[CENTER]
[B][SIZE=5]اولین سیگار . . . اولین پیک . . . اولین عشق . . . “هرگز فراموش نمیشه”[/SIZE][/B]
[/CENTER]
در فایل پیوست ابتدا مسیر فولدر مورد نظر را مشخص کنید و سپس ماکرو را اجرا کنید
کد PHP:
Sub ListFiles()
'Set a reference to Microsoft Scripting Runtime by using 'Tools > References in the Visual Basic Editor (Alt+F11)
'Declare the variables Dim objFSO As FileSystemObject Dim objFolder As Folder Dim objFile As File Dim strPath As String Dim strFile As String Dim NextRow As Long
Columns("A:C").ClearContents
'Specify the path to the folder strPath = "f:\"
'Create an instance of the FileSystemObject Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder Set objFolder = objFSO.GetFolder(strPath)
'If the folder does not contain files, exit the sub If objFolder.Files.Count = 0 Then MsgBox "No files were found...", vbExclamation Exit Sub End If
'Turn off screen updating Application.ScreenUpdating = False
'Insert the headers for Columns A, B, and C Cells(1, "A").Value = "FileName" Cells(1, "B").Value = "Size" Cells(1, "C").Value = "Date/Time"
'Find the next available row NextRow = Cells(Rows.Count, "A").End(xlUp).Row + 1
'Loop through each file in the folder For Each objFile In objFolder.Files
'List the name, size, and date/time of the current file Cells(NextRow, 1).Value = objFile.Name Cells(NextRow, 2).Value = objFile.Size Cells(NextRow, 3).Value = objFile.DateLastModified
'Determine the next row NextRow = NextRow + 1
Next objFile
'Change the width of the columns to achieve the best fit Columns.AutoFit
'Turn screen updating back on Application.ScreenUpdating = True
کامنت