Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
File Size Code not working
A few weeks back I posted a question about getting code to list file sizes in
a worksheet upon startup. A response was posted and even worked a few times but since then I have not been able to keep this code working. For what it is worth, the code is in a worksheet called StartUp and ideally I want the files to started populating at cell A1. Any assistance on what I am doing incorrectly would be appreciated. Sub Workbook_Open(dir_test) Dim fs, f, s Dim filespec As String Dim count As Integer count = 1 Set fs = CreateObject("Scripting.FileSystemObject") filespec = Dir(ActiveWorkbook.Path & "\*.xls") Do While filespec < "" Set f = fs.GetFile(filespec) s = f.Size n = f.Name Range("A" & count) = n Range("B" & count) = s & " KB" filespec = Dir count = count + 1 Loop End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Compiling Excel VBA code increases workbook file size! | Excel Programming | |||
Code is working in one file but not in another. | Excel Programming | |||
File size problem: standard remedies not working. | Excel Programming | |||
Can we write VBA code to set all column/row's size back to default size? | Excel Programming | |||
Can we write VBA code to set all column/row's size back to default size? | Excel Programming |