Consulting

Results 1 to 3 of 3

Thread: Solved: Detect File Size through VB

  1. #1

    Solved: Detect File Size through VB

    I'm trying to figure out how to determine the size of a file through VB. I found some code on Microsofts website but its bombing out. Here's what i got:

    Dim infoReader As System.IO.FileInfo
    infoReader = My.Computer.FileSystem.GetFileInfo("C:\test\test.txt")
    MsgBox ("File is " & infoReader.Length & " bytes.")


    I ultimately want to pass the current size of a file into a variable so that i can check the size over time.

    Any ideas?

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    How about Filelen

    [vba]

    Debug.Print FileLen("C:\test\ADO Test.xls")
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Works perfectly. Thanks!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •