Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi is it possible to write code to check available space
on a drive from Excel?. TIA Charles |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is a routine posted by Jim Rech a while back
Declare Function GetDiskFreeSpaceExA Lib "kernel32" _ (ByVal lpDirectoryName As String, _ lpFreeBytesAvailableToCaller As Currency, _ lpTotalNumberOfBytes As Currency, _ lpTotalNumberOfBytes As Currency) As Boolean Sub ShowDiskSpace() Dim MyFreeSpace As Currency Dim MyTotalSpace As Currency Dim TotalFreeSpace As Currency If GetDiskFreeSpaceExA("c:\", _ MyFreeSpace, _ MyTotalSpace, _ TotalFreeSpace) Then MyFreeSpace = MyFreeSpace * 10000 MyTotalSpace = MyTotalSpace * 10000 TotalFreeSpace = TotalFreeSpace * 10000 MsgBox "Total space on drive: " & _ Format(MyTotalSpace, "#,###bytes") & Chr(13) & _ "Free space: " & Format(MyFreeSpace, "#,### bytes") End If End Sub -- HTH RP "Charles" wrote in message ... Hi is it possible to write code to check available space on a drive from Excel?. TIA Charles |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
a bit simpler alternative to using api..
Function FreeKB(DriveSpec As String) With CreateObject("Scripting.FileSystemObject") If Not .DriveExists(DriveSpec) Then FreeKB = CVErr(xlErrRef) Else FreeKB = .GetDrive(DriveSpec).FreeSpace \ 1024 End If End With End Function keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool "Charles" wrote: Hi is it possible to write code to check available space on a drive from Excel?. TIA Charles |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
but depends upon Scripting being allowed, not true in many commercial
environments -- HTH RP "keepITcool" wrote in message ... a bit simpler alternative to using api.. Function FreeKB(DriveSpec As String) With CreateObject("Scripting.FileSystemObject") If Not .DriveExists(DriveSpec) Then FreeKB = CVErr(xlErrRef) Else FreeKB = .GetDrive(DriveSpec).FreeSpace \ 1024 End If End With End Function keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool "Charles" wrote: Hi is it possible to write code to check available space on a drive from Excel?. TIA Charles |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Links to mapped drive change to refer to local hard drive | Links and Linking in Excel | |||
Can I save to hard drive AND my flash drive at the same time? | Excel Discussion (Misc queries) | |||
Getting Amount Free Disk Space On A Drive | Excel Discussion (Misc queries) | |||
Pasting a range of information from a foler on F Drive to another folder on same drive | Excel Programming | |||
Find links with code; change from G drive to C drive | Excel Programming |