A family of Microsoft word processing software products for creating web, email, and print documents.
Hi,
Is there anyway to convert or save (200+) Microsoft Word 2016 files on my PC to PDF? Or perhaps someone has written a macro or javascript that can process multiple Word files to do this repetitive task?
Thanks in advance for your assistance.
-Greg
After trolling this site I found my answer here after doing a few minor tweaks:
Sub SaveAllAsPDF()
Dim strFilename As String
Dim strDocName As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
Dim intPos As Integer
Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select folder and click OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show <> -1 Then
MsgBox "Cancelled By User", , "List Folder Contents"
Exit Sub
End If
strPath = fDialog.SelectedItems.Item(1)
If Right(strPath, 1) <> "" Then strPath = strPath + ""
End With
If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(strPath, 1) = Chr(34) Then
strPath = Mid(strPath, 2, Len(strPath) - 2)
End If
strFilename = Dir$(strPath & "*.doc")
While Len(strFilename) <> 0
Set oDoc = Documents.Open(strPath & strFilename)
strDocName = ActiveDocument.FullName
intPos = InStrRev(strDocName, ".")
strDocName = Left(strDocName, intPos - 1)
'This instruction converts to PDF
strDocName = strDocName & ".pdf"
oDoc.SaveAs FileName:=strDocName, _
FileFormat:=wdFormatPDF
oDoc.Close SaveChanges:=wdDoNotSaveChanges
strFilename = Dir$()
Wend
End Sub
Regards,
Greg