Convert Word to PDF then Combine PDF Files

jpsimmon

New Member
Joined
Apr 9, 2015
Messages
28
Hi All,
I have pieced together a process to save as PDF and to rename the PDF. I am hoping extend the process and to add a cover page (PDF) to the produced PDF. So I am hoping to to have a button to:
1. Create PDF from current word doc
2. Rename the PDF
3. Grab a PDF in a separate file location to put in front of my current word doc/PDF
4. Save the file as Step 2 name

VBA Code:
Sub MacroSaveAsPDF()

    Dim strPath As String
    Dim strPDFname As String

    strPDFname = InputBox("Enter name for PDF", "File Name", "2023 Final Pre-Roll Report -")
    If strPDFname = "" Then 
        strPDFname = "2023 Final Pre-Roll Report -"
    End If
    strPath = ActiveDocument.Path
    If strPath = "" Then    
        strPath = Options.DefaultFilePath(wdDocumentsPath) & Application.PathSeparator
    Else
        
        strPath = strPath & Application.PathSeparator
    End If
    ActiveDocument.ExportAsFixedFormat OutputFileName:= _
                                       strPath & strPDFname & ".pdf", _
                                       ExportFormat:=wdExportFormatPDF, _
                                       OpenAfterExport:=False, _
                                       OptimizeFor:=wdExportOptimizeForPrint, _
                                       Range:=wdExportAllDocument, _
                                       IncludeDocProps:=True, _
                                       CreateBookmarks:=wdExportCreateWordBookmarks, _
                                       BitmapMissingFonts:=True
End Sub

I haven't posted questions in a while so please let me know if I am breaking forum rules at anytime in the feed.
Thanks!
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I'd suggest doing it the other way around - have a cover page in Word document format, insert that (or vice-versa), then save the combined file as a PDF. Alternatively, you could insert the PDF into the Word document, then save the combined file as a PDF - but the results may be less satisfactory.
 
Upvote 0
I'd suggest doing it the other way around - have a cover page in Word document format, insert that (or vice-versa), then save the combined file as a PDF. Alternatively, you could insert the PDF into the Word document, then save the combined file as a PDF - but the results may be less satisfactory.
Thanks Mac! I was initially just going to do that, but the marketed images used for the cover page are unavailable to make into a Word Doc, and it doesn't export-to-word very well.
 
Upvote 0
You can import a PDF into a Word document (via Insert|Object) without converting the PDF to Word format.

Word VBA has no facility for combining PDFs.
 
Upvote 0
You can import a PDF into a Word document (via Insert|Object) without converting the PDF to Word format.

Word VBA has no facility for combining PDFs.

Thanks Pod. Unfortunately the function loses the quality/scaling of the imported PDF document. That's why I was hoping to do the process separately through VBA.
 
Upvote 0
The scaling should remain unchanged. If it's a full-page spread, though, you might do best to import it into the page header. You might also want to ensure Word's image compression is disabled - see under File|Options|Advanced>Image Size and Quality:Do not compress images in file.
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,143
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top