I need to create a macro that will process every subfolder in a folder and import the 4 png files in each subfolder, arrange the 4 files as a collage, then export as a transparent png file. I have code to where i can get the file names from the subfolders. I'm stuck on how to import and export them. I assume I can record a macro for the arranging of the files and place inside my code.
Here is my code so far(I found most of it on these forums)
Option Explicit
Public Sub test()ProcessFolder "o:\temp\navyratesWfolder\navyratesCollage"End Sub
Private Sub EnumSubFolders(ByVal SrcFolder As String, ByVal Folders As Collection)Dim f As String f = Dir(SrcFolder & "\*.*", vbDirectory) While f <> ""If f <> "." And f <> ".." And (GetAttr(SrcFolder & "\" & f) And vbDirectory) <> 0 ThenFolders.Add SrcFolder & "\" & fEnd Iff = Dir()WendEnd Sub
Private Sub ProcessFolder(ByVal SrcFolder As String)Dim f As String, sFolder As VariantDim Folders As New CollectionDim n As Long ' Create a list of folders and subfoldersEnumSubFolders SrcFolder, Folders n = 1While n <= Folders.CountEnumSubFolders Folders(n), Foldersn = n + 1Wend ' Process the png files in each of the folders foundFor Each sFolder In Folders' You have the subfolder info here in sFolderMsgBox sFolder' this gathers files in subfolder that matches the patter inside the ()f = Dir(sFolder & "\*.png")'This processes each fileWhile f <> ""ProcessFile sFolder & "\" & ff = Dir()WendNext sFolderEnd Sub
Private Sub ProcessFile(ByVal sFile As String)MsgBox "test" + sFileEnd Sub