Macro to Save as Printable PDF (No Text Copy / Edit permissions)

seenai

Board Regular
Joined
Mar 31, 2013
Messages
54
Hi

I have the below vba code to save as PDF. I need to protect PDF with permission for Printing.
But no text copying to be permitted.
Sample Password for PDF is 'mypassword'.

Request your help.



Code:
Sub PDF_Mail()' PDF Macro - Works in Excel 2007, when SaveasPDF Addin is Installed'
    Dim rRng As String
    Dim i As Integer
    i = 4
    Do While i < 100000
    rRng = "A" & i
    Sheets("PrintList").Select
    Range(rRng).Select
    Selection.Copy
    If ActiveCell.Value <> "" Then
    Sheets("Receipt").Select
    Range("D10").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="D:\ThatsMyChild\" & Range("AD4")
    FName = "D:\ThatsMyChild\" & Range("AD4") & ".pdf"


    Call receipt_mail
    Sheets("receipt").Select
    Else
    Exit Sub
    End If
    i = i + 1
    Loop
 End Sub
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,214,614
Messages
6,120,530
Members
448,969
Latest member
mirek8991

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top