Posts Tagged ‘Tamaño de un Archivo Visual Basic’

Saber el Tamaño de un Archivo con VB6

2

Este ejemplo permite saber el tamaño de un archivo,ingresando la ruta del mismo.Usa como metodo La libreria Microsoft Scripting Runtime,que la tenes que agregar desde el menu Proyecto–>Referencias.

En el Formulario pone:

Private Sub Form_Load()
Dim objFSO As Scripting.FileSystemObject
Dim objFile
Set objFSO = New Scripting.FileSystemObject
Set objFile = objFSO.GetFile("C:\Archivo.txt")
MsgBox "El Archivo " & objFile.Name & ",Tiene un Tamaño de " & objFile.Size & " bytes", vbInformation + vbOKOnly, "Tamaño de archivo"
Set objFile = Nothing
Set objFSO = Nothing
End Sub

Pone la ruta que quieras con el nombre y extencion del archivo, acordate de agregar la Referencia sino no funciona.


Post navigation