Originally Posted by
macropod
In that case, try:
Sub CertificadosPDF()
Application.ScreenUpdating = False
Dim strPath As String, strName As String
strPath = "C:\Users\" & Environ("Username") & "\Desktop\Certificates\"
Do While Documents.Count > 0
With Documents(1)
strName = Split(.Range.Paragraphs.First.Text, vbCr)(0) & ".pdf"
.SaveAs2 FileName:=strPath & strName, FileFormat:=wdFormatPDF, AddToRecentFiles:=False
.Close False
End With
Loop
Application.ScreenUpdating = True
End Sub
Thanks, you have helpme with these macro. But it gives me some error.
I have made some changes and i dont know why it doesnt work, my actually macro:
Sub CertificadosPDForiginalmodificado()
Application.ScreenUpdating = False
Dim strPath As String, strName As String
strPath = "C:\Users\Desktop\certificates\"
Do While Documents.Count > 0
With Documents(1)
strName = ActiveDocument.Paragraphs(3).Range.Text
ActiveDocument.SaveAs2 FileName:=strPath & strName & "pdf", FileFormat:=wdFormatPDF, AddToRecentFiles:=False
.Close False
End With
Loop
Application.ScreenUpdating = True
End Sub
Also I have this macro that works but I have to click on "save" for every document when the saving window appears.
Sub CertificadosPDFguardarunoporuno()
Application.ScreenUpdating = False
Dim strPath As String, strName As String
strPath = "C:\Users\Desktop\certificates\"
Do While Documents.Count > 0
With Documents(1)
ActiveDocument.Save
strName = Left(ActiveDocument.FullName, Len(ActiveDocument.FullName) - 4)
strName = strName & "pdf"
ActiveDocument.ExportAsFixedFormat OutputFileName:=strName, _
ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=99, _
Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
BitmapMissingFonts:=True, UseISO19005_1:=True
ActiveDocument.Close (False)
End With
Loop
Application.ScreenUpdating = True
End Sub