Results 1 to 3 of 3

Thread: Very easy question I think - Please take a look.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Australia
    Posts
    149

    Unhappy

    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

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    By using the FileLen function:
    Code:
    MsgBox "The file size is " & FileLen("C:\MyFile.txt")

  3. #3
    Member
    Join Date
    Aug 2000
    Posts
    60

    Cool 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
  •  



Click Here to Expand Forum to Full Width