Log in  \/ 
x
or
x
x
Register  \/ 
x

or

Kutools for Excel 22.00 HOT

300+ Powerful Features You Must Have in Excel

Kutools-for-Excel

Kutools for Excel is a powerful add-in that frees you from performing time-consuming operations in Excel, such as combine sheets quickly, merge cells without losing data, paste to only visible cells, count cells by color and so on. 300+ powerful features / functions for Excel 2019, 2016, 2013, 2010, 2007 or Office 365!

Read More Download Buy now

Office Tab 14.00HOT

Adding Tabbed Interface for Office

Office Tab

It enables tabbed browsing, editing, and managing of Microsoft Office applications. You can open multiple documents / files in a single tabbed window, such as using the browser IE 8/9/10, Firefox, and Google Chrome. It's compatible with Office 2019, 2016, 2013, 2010, 2007, 2003 or Office 365. Demo

Read More Download Buy now

Kutools for Outlook 13.00NEW

100+ Powerful Features for Outlook

Kutools-for-Outlook

Kutools for Outlook is a powerful add-in that frees you from time-consuming operations which majority of Outlook users has to perform daily! It can save your time from using Microsoft Outlook 2019, 2016, 2013, 2010 or Office 365!

Read More Download Buy now

Kutools for Word  9.00NEW

100+ Powerful Features for Word

Kutools-for-Word

Kutools for Word is a powerful add-in that frees you from time-consuming operations which majority of Word users have to perform daily! It can save your time from using Microsoft Word / Office 2019, 2016, 2013, 2010, 2007, 2003 or Office 365!

Read More Download Buy now

Classic Menu for Office

Bringing Back Your Familiar Menus

Restores the old look and menus of Office 2003 to Microsoft Office 2019, 2016, 2013, 2010, 2007 or Office 365. Don’t lose time in finding commands on the new Ribbon. Easy to deploy to all computers in enterprises and organizations.

Read More Download Buy now

How to batch convert multiple Word documents to pdf files?

It is easy for you to convert a Word document to a PDF file with the Save as function in Word. But if you want to convert all Word documents in a folder to separate PDF files at once, how can you achieve it? This article will show you a VBA code to batch convert multiple Word documents to pdf files in Word.

Batch convert multiple Word documents to pdf files with VBA

Batch convert multiple Word documents to pdf files with Kutools for Word


Easily batch convert multiple Word documents to pdf files in Word:

The Document Format Converter utility of Kutools for Excel can help you quickly convert all .docx format documents in a specified folder to pdf files. See screenshot:

Kutools for Word: with more than 100 handy Word add-ins, free to try with no limitation in 30 days. Download and free trial Now!


Batch convert multiple Word documents to pdf files with VBA

The following VBA code helps you quickly convert all Word documents in a folder to pdf files at once. Please do as follows.

1. In Word, press the Alt + F11 keys to open the Microsoft Visual Basic for Applications window.

2. In the Microsoft Visual Basic for Applications window, click Insert > Module, then copy below VBA code into the Module window.

VBA code: Batch convert multiple Word documents to pdf files in Word

Sub ConvertWordsToPdfs()
'Updated by Extendoffice 20181123
    Dim xIndex As String
    Dim xDlg As FileDialog
    Dim xFolder As Variant
    Dim xNewName As String
    Dim xFileName As String
    Set xDlg = Application.FileDialog(msoFileDialogFolderPicker)
    If xDlg.Show <> -1 Then Exit Sub
    xFolder = xDlg.SelectedItems(1) + "\"
    xFileName = Dir(xFolder & "*.*", vbNormal)
    While xFileName <> ""
        If ((Right(xFileName, 4)) <> ".doc" Or Right(xFileName, 4) <> ".docx") Then
            xIndex = InStr(xFileName, ".") + 1
            xNewName = Replace(xFileName, Mid(xFileName, xIndex), "pdf")
            Documents.Open FileName:=xFolder & xFileName, _
                ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
                PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
                WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
                wdOpenFormatAuto, XMLTransform:=""
            ActiveDocument.ExportAsFixedFormat OutputFileName:=xFolder & xNewName, _
                ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
                wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _
                Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
                CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
                BitmapMissingFonts:=True, UseISO19005_1:=False
            ActiveDocument.Close
        End If
        xFileName = Dir()
    Wend
End Sub

3. Press the F5 key to run the code.

4. A Browse dialog pops up, please select the folder which contains Word documents you will convert to pdf files, and click the OK button.

Then all Word documents in selected folder are converted to separate pdf files at once. See screenshot:


Batch convert multiple Word documents to pdf files with Kutools for Word

If VBA code is hard to handle, you can try the Convert documents utility of Kutools for Word to solve the problem.

Kutools for Word : With more than 100 handy Word add-ins, free to try with no limitation in 30 days.

1. Click Kutools Plus > Doc/Docx. See screenshot:

2. In the Document Format Converter window, you need to do as follows:

2.1) Select the folder contains documents you will convert to pdf in the Source file folder section;

2.2 Select Convert docx to pdf from the Format Convert drop-down list;

2.3) By default, the Destination path same as source box is checked. If you want to place all converted pdf files in the same folder, just keep this option selected;

If you want to separate the pdf files and the source documents, you need to uncheck the Destination path same as source box, and select a new folder to save the pdf files in the Save to box;

2.4) Click the Start button. See screenshot:

3. Then a dialog box pops up to tell you how many documents have been successfully converted, click the OK button and close the Document Format Converter window.

Now all .docx format documents are converted to pdf files.

If you want to have a free trial of this utility, please go to free download the software first, and then go to apply the operation according above steps.



Recommended Word Productivity Tools

 

Kutools For Word - More Than 100 Advanced Features For Word, Save Your 50% Time

  • Complicated and repeated operations can be done one-time processing in seconds.
  • Insert multiple images across folders into Word document at once.
  • Merge and combine multiple Word files across folders into one with your desired order.
  • Split the current document into separate documents according to heading, section break or other criteria.
  • Convert files between Doc and Docx, Docx and PDF, collection of tools for common conversions and selection, and so on...
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Eric Smith · 1 months ago
    Hello, Thank you so much for this code. It is working well, however, I get a dialog box after each conversion to save the word doc and I have to save. Can you include code in the macro to make that save and close the file instead of having to close each one?
  • To post as a guest, your comment is unpublished.
    9aks92 · 2 months ago
    Hi,

    I get runtime error '424':
    Object required

    image attached.


    Please help.

    Thanks.
  • To post as a guest, your comment is unpublished.
    Akshay · 2 months ago
    Hi,

    I get runtime error '424':
    Object required

    at the below code

    Documents.Open Filename:=xFolder & xFileName, _
    ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, _
    PasswordDocument:="", PasswordTemplate:="", Revert:=False, _
    WritePasswordDocument:="", WritePasswordTemplate:="", Format:= _
    wdOpenFormatAuto, XMLTransform:=""


    wdOpenFormatAuto = 0 it says.

    Please help.

    Thanks.
  • To post as a guest, your comment is unpublished.
    Stefan · 9 months ago
    Hi there,


    is there an easy way to adjust the VBA Code so that the Documents are convertet to .txt-Files?
  • To post as a guest, your comment is unpublished.
    Sammy · 10 months ago
    Is there any way to have the file name taken from the text of the document?
  • To post as a guest, your comment is unpublished.
    Marzio · 11 months ago
    VBA if i try to convert file that contains macros the macro swith to open file and ends without close file.
  • To post as a guest, your comment is unpublished.
    michaelwaung · 1 years ago
    So nice blog, Thanks for sharing this blog. It Has so useful information for users. I liked this information so much.
    Hope you keep sharing such kind of information convert word doc to html

Feature Tutorials