如何从P更改下面的驱动器号以改为使用网络完整路径名?VBA Excel - 使用网络路径名称不是驱动器号
我似乎无法弄清楚
'Creating a FileSystemObject
Public FSO As New FileSystemObject
Sub DiskSpace()
Dim drv As Drive
Dim Space As Double
Set drv = FSO.GetDrive("P:") ' Creating the the Drive object
Space = drv.FreeSpace
Space = Space/1073741824 'converting bytes to GB
Space = WorksheetFunction.Round(Space, 2) ' Rounding
MsgBox "P: has free space = " & Space & " GB"
End Sub
可用空间适用于驱动器而不适用于特定路径。 – NoChance
我建议避免使用'Space'作为变量,因为它也是一个VBA函数。 –