PDA

View Full Version : Solved: Detect File Size through VB



jtrowbridge
08-28-2008, 02:48 PM
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?:help

Bob Phillips
08-28-2008, 03:36 PM
How about Filelen



Debug.Print FileLen("C:\test\ADO Test.xls")

jtrowbridge
08-29-2008, 07:29 AM
Works perfectly. Thanks!

:rotlaugh: