ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get File Size (https://www.excelbanter.com/excel-programming/320485-get-file-size.html)

Frank

Get File Size
 
Hi I am trying to show the file size in a form, I have got a form that
collects file names and creation date modified date but I also want to show
the file size of each file found. can any body help to get the info above I
am using API functions but I can't find anything about file size.
TIA
Frank

Norman Jones

Get File Size
 
Hi Frank.

Dim FLen as long

Flen = FileLen(ActiveWorkbook.FullName)


---
Regards,
Norman



"Frank" wrote in message
...
Hi I am trying to show the file size in a form, I have got a form that
collects file names and creation date modified date but I also want to
show
the file size of each file found. can any body help to get the info above
I
am using API functions but I can't find anything about file size.
TIA
Frank




Frank

Get File Size
 
Thanks but it wont just be workbooks listed the form list all files in a
directory and puts the info into an access dB so I need to get file size for
each file found.
Thanks anyway.

"Frank" wrote:

Hi I am trying to show the file size in a form, I have got a form that
collects file names and creation date modified date but I also want to show
the file size of each file found. can any body help to get the info above I
am using API functions but I can't find anything about file size.
TIA
Frank


Bob Phillips[_6_]

Get File Size
 
Frank,

Here is a simple function to get fileinfo

Function FileInfo(path As String, Optional info As String = "Created")
Dim FSO As Object
Dim oFile As Object
Dim i As Long

Set FSO = CreateObject("Scripting.FileSystemObject")
Set oFile = FSO.GetFile(path)

Select Case LCase(info)
Case "accessed": FileInfo = oFile.DateLastAccessed
Case "modified": FileInfo = oFile.DateLastModified
Case "created": FileInfo = oFile.DateCreated
Case "path": FileInfo = oFile.path
Case "size": FileInfo = oFile.Size
End Select

End Function

call it like so

fileinfo("C:\myTest\volker1.xls","Size")

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Frank" wrote in message
...
Thanks but it wont just be workbooks listed the form list all files in a
directory and puts the info into an access dB so I need to get file size

for
each file found.
Thanks anyway.

"Frank" wrote:

Hi I am trying to show the file size in a form, I have got a form that
collects file names and creation date modified date but I also want to

show
the file size of each file found. can any body help to get the info

above I
am using API functions but I can't find anything about file size.
TIA
Frank




Tom Ogilvy

Get File Size
 
http://msdn.microsoft.com/library/de...e_data_str.asp

nFileSizeHigh
High-order DWORD of the file size. This member has no meaning for
directories.
nFileSizeLow
Low-order DWORD of the file size. This member has no meaning for
directories.

Usage is with the API function GetFileAttributesEx

--
Regards,
Tom Ogilvy

"Frank" wrote in message
...
Hi I am trying to show the file size in a form, I have got a form that
collects file names and creation date modified date but I also want to

show
the file size of each file found. can any body help to get the info above

I
am using API functions but I can't find anything about file size.
TIA
Frank





All times are GMT +1. The time now is 09:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com