You can modify the function as follows and use it in col G to return numeric
value only. (Set col precision to 3dp)
Try...
Public Function GetFileSize(CellRef As Range) As Double
Dim sPath$, sFldr$, sFile$, vFldr, vSize, v1
Const File_Size& = 1
sPath = CellRef.Value
With CreateObject("scripting.FileSystemobject")
sFldr = .GetParentFolderName(sPath)
sFile = .GetFileName(sPath)
End With
Set vFldr = CreateObject("Shell.Application").Namespace("" & sFldr & "")
If vFldr Is Nothing Then Exit Function
With vFldr
For Each v1 In .Items
If v1.Name = sFile Then vSize = .GetDetailsOf(v1, File_Size): Exit For
Next 'v1
End With
v1 = Split(vSize, " ")
GetFileSize = IIf(v1(1) = "GB", CDbl(v1(0)) / 1, CDbl(v1(0)) / 1000)
Set vFldr = Nothing
End Function
--
Garry
Free usenet access at
http://www.eternal-september.org
Classic
VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.
vb.general.discussion