Under this path {c:\testbatpic} ,there are many folders,such as name is abc, def,ghi ... n,
under abc subfolder ,there are a lot of images, such as , 1.jpg,2.jpg ... n.jpg or png files.
many subfolder included many images.
how to type subfolder name with a "heading1"style,in blank pages,and insert every picture of subfolder?
Here is some code,but how modify these code to meet my idea?
Sub loopAllSubFolderSelectStartDirectory()
Dim FSOLibrary As FileSystemObject
Dim FSOFolder As Object
Dim folderName As String
folderName = "C:\testbatpic"
Set FSOLibrary = New FileSystemObject
LoopAllSubFolders FSOLibrary.getfolder(folderName)
End Sub
Sub LoopAllSubFolders(FSOFolder As Object)
Dim FSOSubFolder As Object
Dim FSOFile As Object
For Each FSOSubFolder In FSOFolder.subfolders
LoopAllSubFolders FSOSubFolder
With Selection
.Range.Text = Chr(13) & FSOSubFolder.name
End With
Next
For Each FSOFile In FSOFolder.Files
ActiveDocument.InlineShapes.AddPicture (FSOFile.path)
Next
End Sub