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
Avatarpragati asked 4 months 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:"

    '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

    MsgBox "All folders listed with their size"
End Sub
1 Answers
Best Answer
AvatarArben answered 4 months ago
Your Answer

18 + 12 =

Popular Tags

WP Facebook Auto Publish Powered By :