Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" _
(ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
Public Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Public Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * 260
cAlternate As String * 14
End Type
Private Sub ShowFileInfo()
Dim hFile As Long
Dim WFD As WIN32_FIND_DATA
Dim FullName As String
' FullName is the path and filename
' Substitute any valid file and path
FullName = "c:\autoexec.bat"
hFile = FindFirstFile(FullName, WFD)
If hFile > 0 Then
MsgBox "File size: " & WFD.nFileSizeLow
Else
MsgBox "File not found.", vbCritical, FullName
End If
End Sub
Function FileSize()
Dim fs, f
Application.Volatile [COLOR=green]' get rid of this if calling from a sub[/color]
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.Getfile([[b]myFileName[/b]])
FileSize = UCase(f.Name) & " uses " & f.Size & " bytes."
End Function
Sub FileSize()
Dim strFileSize As String
On Error GoTo NoGo
strFileSize = FileLen(ActiveWorkbook.FullName) / 1024
MsgBox ActiveWorkbook.Name & " is " & Format(strFileSize, "#,#00") & " KBytes" & vbLf & _
"It has been saved as " & ActiveWorkbook.FullName & " "
Exit Sub
NoGo:
MsgBox "File not saved"
End Sub