Skip to content

Instantly share code, notes, and snippets.

@DaKeZhang7412
Created February 16, 2016 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DaKeZhang7412/3a3227bd93e4fe4cd017 to your computer and use it in GitHub Desktop.
Save DaKeZhang7412/3a3227bd93e4fe4cd017 to your computer and use it in GitHub Desktop.
Convert words into PDFs in batch
Sub converttopdf()
'
' converttopdf Macro in batch
' https://msdn.microsoft.com/en-us/library/office/aa220734(v=office.11).aspx
'
'
Dim strDocName As String
Dim intPos As Integer
For Each aDocument In Application.Documents
strDocName = aDocument.Name
intPos = InStrRev(strDocName, ".")
strDocName = Left(strDocName, intPos - 1)
strDocName = strDocName & ".pdf"
aDocument.SaveAs FileName:=strDocName, FileFormat:=wdFormatPDF
Next aDocument
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment