Hey everyone,

I've got a userform that has a command button that saves the active document as a word file and exports as a pdf to a nominated folder location (thanks to the two G wizards!).

I'm not sure if the following is possible or not and I honestly have no idea how to determine or test if I can get this to work.

The code asks the user for the folder and then saves the file as said.

What I want to attempt to do is:

1. Save the file as word and pdf (this works YAY)
2. If the folder contains a certain list of files (1.pdf, a54.pdf for example), I want to automatically merge these existing "template files" into the saved pdf.
3. Open the merged pdf to view

The created document will always be the exact same amount of pages but two of the "template" files have varying page lengths.

The code I have for saving is:

'From my favourite G man!
Private Sub CommandButton3_Click()
'Opens a box to nominate folder
Dim fd As FileDialog
 Dim strFolder As String
 Dim strName As String
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
 With fd
     .Title = "Save The Report To The Job Folder"
     If .Show = -1 Then
         strFolder = .SelectedItems(1)
     Else
         MsgBox "You did not select a folder."
         Exit Sub
     End If
 End With
 
 ChDir strFolder 'stores folder path
 strName = "\GEA." & ActiveDocument.Variables("PN").Value & ".R." & ActiveDocument.Variables("LT") & ".Rev." & ActiveDocument.Variables("RN")
 ActiveDocument.SaveAs2 strFolder & strName & ".docx"
 
 strName = strName & ".pdf"
 ActiveDocument.ExportAsFixedFormat OutputFileName:=strFolder & "\" & strName, _
                               ExportFormat:=wdExportFormatPDF, OpenAfterExport:=True, OptimizeFor:= _
                               wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, to:=99, _
                               Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
                               CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
                               BitmapMissingFonts:=True, UseISO19005_1:=True

If it's possible --> I think here I need to do something like If Template File A.pdf exists in ChDir then
" merge with exported document at end of pdf range
              repeat for 2 or 3 other template files



End Sub
Any guidance or help would be amazing - I know I'm asking for a lot here so even if you just point me in the right direction, I would be very grateful.