Skip to content

Latest commit

 

History

History
47 lines (35 loc) · 1.18 KB

totalsize-property.md

File metadata and controls

47 lines (35 loc) · 1.18 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
TotalSize property (Visual Basic for Applications)
vblr6.chm2181964
vblr6.chm2181964
Office.TotalSize
3c5d7904-3abe-2733-abe2-f329979863da
12/19/2018
medium

TotalSize property

Returns the total space, in bytes, of a drive or network share.

Syntax

object.TotalSize

The object is always a Drive object.

Remarks

The following code illustrates the use of the TotalSize property.

Sub ShowSpaceInfo(drvpath)
    Dim fs, d, s
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set d = fs.GetDrive(fs.GetDriveName(fs.GetAbsolutePathName(drvpath)))
    s = "Drive " & d.DriveLetter & ":"
    s = s & vbCrLf
    s = s & "Total Size: " & FormatNumber(d.TotalSize/1024, 0) & " Kbytes"
    s = s & vbCrLf
    s = s & "Available: " & FormatNumber(d.AvailableSpace/1024, 0) & " Kbytes"
    MsgBox s
End Sub

See also

[!includeSupport and feedback]