help with vb macro for word

  reddwarfcrew 12:59 29 Nov 2003
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 2003

... all the vb experts gone :-(

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

Elsewhere on IDG sites

Acer Predator 21X review

These hilarious robot GIFs will be sure to make you smile

Best podcast apps for iPhone & iPad

Nokia 8 : design, caractéristiques techniques, date de sortie