Excel VBA SaveAs "Read-only" PDF file
The following code successfully saves an excel sheet as PDF. I would like to save it as a file, that can be opened by everyone, but not edited with the "fill and sign" feature, that is provided by Adobe Acrobat Reader DC. I have tried to simply add the following, but that does not work:
Attributes:=vbReadOnly
Here is the rest of the code:
Dim sPath As String
sPath = "O:\"
With Worksheets("Sheet 1")
.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=sPath & UserForm.TextBox1.Value & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End With
Solution 1:
You should be able to use SetAttr
after saving.
SetAttr "c:\path\yourfilename.pdf", vbReadOnly