Try to search your question here, if you can't find : Ask Any Question Now ?

Invalid qualifier error on Folder – Name.Name

HomeCategory: stackoverflowInvalid qualifier error on Folder – Name.Name
pragati asked 3 days ago

I picked up code online, for getting folder names and size

I get Invalid qualifier error @
ThisWorkbook.Sheets(1).Cells(i, 1) = Folder - Name.Name

Sub GetFolderSizeDetails()

    Dim FSO As FileSystemObject
    Dim FolderName As Folder

    'Assign path of folder for which you want it's sub folder list and size
    RootPath = "C:"
    ThisWorkbook.Sheets(1).Range("A2:D100").ClearContents

    'Initialize Variables And Objects
    i = 1
    Set FSO = New FileSystemObject

    'Loop to get each Subfolder in the Root Path
    For Each FolderName In FSO.GetFolder(RootPath).SubFolders
        i = i + 1
        ThisWorkbook.Sheets(1).Cells(i, 1) = Folder - Name.Name
        On Error Resume Next
        'Folder-Name.Size returns value in Bytes. Thus divided by 1024 to convert in MB
        ThisWorkbook.Sheets(1).Cells(i, 2) = (Folder - Name.Size / 1024) / 1024
    Next

    MsgBox "All folders listed with their size"
End Sub
1 Answers
Best Answer
Arben answered 3 days ago
Your Answer

9 + 1 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com