Hy everyone.
Need one script /Macro to save a word doc to a pdf with one password protection (should be predefined). Is there any way.
I m using win 10/office 2019 and installed adobe Dc.
I tryed several options and found only 2 macro for saving a word file with passwd ad follow:
Many thanks for your great helpSub Passwort() ' Passwort Makro Set aDoc = ActiveDocument If aDoc.ProtectionType <> wdNoProtection Then aDoc.Unprotect Selection.InsertBefore "XY" aDoc.Protect Type:=wdAllowOnlyRevisions, Password:=strPassword End If End Sub Sub Passwed_Setzten() 'Passwed_Setzten Makro With ActiveDocument .ReadOnlyRecommended = True .Password = "XY" .WritePassword = "XY" .RemovePersonalInformation = False .RemoveDateAndTime = False ' Author setzen .BuiltInDocumentProperties(3) = "XY" End With With Options .WarnBeforeSavingPrintingSendingMarkup = False .StoreRSIDOnSave = True .ShowMarkupOpenSave = True End With End Sub 'for saving to a pdf file I m using folowing script, but this is not password protected 'Directly save Word file as Pdf and aumatically open it. Sub DirectlySaveDocxToPdf() Dim objDoc As Document Set objDoc = ActiveDocument objDoc.ExportAsFixedFormat _ OutputFileName:=Replace(objDoc.FullName, ".docx", ".pdf"), _ ExportFormat:=wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:=wdExportOptimizeForPrint, _ Range:=wdExportAllDocument, Item:=wdExportDocumentContent End Sub Sub Direct_Save_pdf() End Sub




Reply With Quote