Waiting for file, check filesize then process... Help please
I've written this little prog that will check for a file.
If a file is found then will check the file size then pause, check the file size again and compaire the two. If the file size is same then process file else wait .
If anyone can help, would be great.
VB Code:
Dim FSO As New FileSystemObject 'set fso as new file system object
Dim Filen As File 'This is a file
Dim FileLena, FileLenb As Long
If File1.ListCount = 0 Then
FileName = File1.FileName
Do Until FileLena = FileLenb
Set Filen = FSO.GetFile(FileName) 'Set fullstring as full filename and pick the file
FileLena = Filen.Size 'Get file size
Text1.Text = Filen.Size 'display the filesize in text box 1
Wait 1 'wait 1 seconds
FileLenb = Filen.Size 'Get file size
Text2.Text = Filen.Size 'display the filesize in text box 2
Wait 1
Loop
Re: Waiting for file, check filesize then process... Help please
I don't use FSO myself, it adds too much overhead for simple tasks like this.
The FileLen function is easily enough in this case:
VB Code:
Dim FileLena [b]as Long[/b], FileLenb As Long 'FileLena was a variant as you did it ;)
[b]If File1.ListCount = 0 Then 'erm... this seems like a problem![/b]
FileName = File1.FileName
Do
FileLena = FileLen(FileName) 'Get file size
Text1.Text = FileLena 'display the filesize in text box 1
Wait 1 'wait 1 seconds
FileLenb = FileLen(FileName) 'Get file size
Text2.Text = FileLenb 'display the filesize in text box 2
Wait 1
Loop [b]Until FileLena = FileLenb [/b] 'you want the code to run at least once, so this needs to go at the end