Stored in these folders is powerpoint documents. I'm trying to get the filenames of each of these powerpoint documents and place them into a word document.
Set cSubDirs = New Collection
sSubDir = Dir(sParentDir & "\*", vbDirectory)
Do While sSubDir <> ""
cSubDirs.Add sParentDir & "\" & sSubDir
sSubDir = Dir
DoEvents
Loop
Set oDoc = New Word.Document
For i = 1 To cSubDirs.Count
sFile = Dir(cSubDirs(i) & "\*.ppt"
Do While sFile <> ""
Debug.Print sParentDir & "\" & sFile
Set oPara = oDoc.Paragraphs.Add
oPara.Range.Text = sParentDir & "\" & sFile & vbCr
Set oPara = Nothing
sFile = Dir
DoEvents
Loop
Next i
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.