|
-
Aug 31st, 2000, 06:45 PM
#1
Thread Starter
Addicted Member
Sorry,
I think that this is a very easy question, I just want to know how you can get the file size of a file using vb code.
Any source would be great
Thanks
Hurgh
-
Aug 31st, 2000, 06:51 PM
#2
By using the FileLen function:
Code:
MsgBox "The file size is " & FileLen("C:\MyFile.txt")
-
Aug 31st, 2000, 06:55 PM
#3
Member
Solution
Dim FilePath As String
Dim LengthOfFile As Long
Open FilePath For Binary As #1
LengthOfFile = LOF(1)
Close #1
FilePath is the path and filename of the file you want to know the size of e.g c:\io.sys
LengthOfFile is exactly what it says it is, the length of the file in bytes. Past that
1 KiloByte = 1024 Bytes
1 MegaByte = 1024 Kb
1 Gigabyte = 1024 Mb
Hope this helps you,
Grant French
-----------------------------------------------
E-Mail: [email protected]
ICQ: 33122184
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|