help with vb macro for word

  reddwarfcrew 12:59 29 Nov 03
Locked

Hi, i have the following code that lists all 'mpg' files in a folder. Is it possible to tweak it so that it also displays the file size next to each file?

cheers.

Sub ListDocNamesInFolder()
Dim sMyDir As String
Dim sDocName As String

' The path to obtain files.
sMyDir = "C:\Documents and Settings\Steve Allen\My Documents\My Videos\Converted files\various\"
sDocName = Dir(sMyDir & "*.mpg")

' Add new document.
Documents.Add

' Insert folder name and file names in document.
Selection.TypeText "Documents in folder " & sMyDir & vbCr & vbCr
While sDocName > ""
' Insert filename in document.
Selection.TypeText sDocName & vbCr
' Get next file name.
sDocName = Dir()
Wend
End Sub

  reddwarfcrew 16:49 29 Nov 03

... all the vb experts gone :-(

This thread is now locked and can not be replied to.

Best phone camera 2016/2017: Galaxy S7 vs iPhone 7 vs Google Pixel vs HTC 10 Evo vs OnePlus 3T vs…

1995-2015: How technology has changed the world in 20 years

These are the Best Christmas Ads and Studio Projects of 2016

Super Mario Run preview | Hands-on first impressions of Super Mario Run: Mario's iPhone & iPad…