Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default API Function Call - GetFreeDiskSpace

Friends,

I am running Excel 2000 on Win XP.

I created a VBA User Defined Function that references the follwing API
function:

Private Declare Function GetDiskFreeSpace Lib "kernel32" _
(ByVal lpRootPathName As String, lpSectorsPerCluster As _
Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As _
Long, lpTotalNumberOfClusters As Long) As Long

Question: Code seems to be working okay (I have serveral other API calls in
the same module), but I am getting Runtime Error 453 "Can't Find DLL Entry
Point in Kernal 32"

Has the name of the DLL changed since Win 2000? How do I need to change the
above API function declaration so that it is referencing the right DLL?

Thanks for your help ...

Bill Morgan




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default API Function Call - GetFreeDiskSpace

Hi,
Maybe try to declare with the Alias "GetDiskFreeSpaceA":

Public Declare Function GetDiskFreeSpace Lib "kernel32" _
Alias "GetDiskFreeSpaceA" _
(ByVal lpRootPathName As String, _
lpSectorsPerCluster As Long, _
lpBytesPerSector As Long, _
lpNumberOfFreeClusters As Long, _
lpTtoalNumberOfClusters As Long) As Long
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"bill_morgan" wrote:

Friends,

I am running Excel 2000 on Win XP.

I created a VBA User Defined Function that references the follwing API
function:

Private Declare Function GetDiskFreeSpace Lib "kernel32" _
(ByVal lpRootPathName As String, lpSectorsPerCluster As _
Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As _
Long, lpTotalNumberOfClusters As Long) As Long

Question: Code seems to be working okay (I have serveral other API calls in
the same module), but I am getting Runtime Error 453 "Can't Find DLL Entry
Point in Kernal 32"

Has the name of the DLL changed since Win 2000? How do I need to change the
above API function declaration so that it is referencing the right DLL?

Thanks for your help ...

Bill Morgan




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default API Function Call - GetFreeDiskSpace

Perfect solution. Thank you ...

"sebastienm" wrote:

Hi,
Maybe try to declare with the Alias "GetDiskFreeSpaceA":

Public Declare Function GetDiskFreeSpace Lib "kernel32" _
Alias "GetDiskFreeSpaceA" _
(ByVal lpRootPathName As String, _
lpSectorsPerCluster As Long, _
lpBytesPerSector As Long, _
lpNumberOfFreeClusters As Long, _
lpTtoalNumberOfClusters As Long) As Long
--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"bill_morgan" wrote:

Friends,

I am running Excel 2000 on Win XP.

I created a VBA User Defined Function that references the follwing API
function:

Private Declare Function GetDiskFreeSpace Lib "kernel32" _
(ByVal lpRootPathName As String, lpSectorsPerCluster As _
Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As _
Long, lpTotalNumberOfClusters As Long) As Long

Question: Code seems to be working okay (I have serveral other API calls in
the same module), but I am getting Runtime Error 453 "Can't Find DLL Entry
Point in Kernal 32"

Has the name of the DLL changed since Win 2000? How do I need to change the
above API function declaration so that it is referencing the right DLL?

Thanks for your help ...

Bill Morgan




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default API Function Call - GetFreeDiskSpace

Another option:

Option Explicit
Sub testme()

Dim myDriveLetter As String


' With a reference (tools|references) to microsoft scripting runtime
' Dim FSO As Scripting.FileSystemObject
' Dim myDrive As Scripting.Drive
' Set FSO = New Scripting.FileSystemObject

' without that reference
Dim FSO As Object
Dim myDrive As Object
Set FSO = CreateObject("scripting.filesystemobject")

myDriveLetter = "C"
Set myDrive = FSO.GetDrive(myDriveLetter)
MsgBox Format(myDrive.freeSpace, "0,000")


End Sub

sub testme02()
'or just this:
Dim myDriveLetter As String

myDriveLetter = "C"
MsgBox CreateObject("scripting.filesystemobject") _
.GetDrive(myDriveLetter).freeSpace

end sub



bill_morgan wrote:

Friends,

I am running Excel 2000 on Win XP.

I created a VBA User Defined Function that references the follwing API
function:

Private Declare Function GetDiskFreeSpace Lib "kernel32" _
(ByVal lpRootPathName As String, lpSectorsPerCluster As _
Long, lpBytesPerSector As Long, lpNumberOfFreeClusters As _
Long, lpTotalNumberOfClusters As Long) As Long

Question: Code seems to be working okay (I have serveral other API calls in
the same module), but I am getting Runtime Error 453 "Can't Find DLL Entry
Point in Kernal 32"

Has the name of the DLL changed since Win 2000? How do I need to change the
above API function declaration so that it is referencing the right DLL?

Thanks for your help ...

Bill Morgan


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a do not call function? pokdbz Excel Discussion (Misc queries) 2 December 27th 07 04:00 PM
How do I call this function? vrk1 Excel Programming 1 June 18th 05 01:05 AM
how i can call the function reneabesmer Excel Worksheet Functions 2 May 2nd 05 12:13 PM
Function Call Phil Hageman Excel Programming 4 October 9th 03 04:32 PM
call function sirron Excel Programming 1 August 26th 03 03:39 PM


All times are GMT +1. The time now is 12:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"