web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to put password fo...
Power Automate
Suggested Answer

How to put password for each PDF file

(0) ShareShare
ReportReport
Posted on by 45
Hello everyone,
 
Does anyone know how to put a password for each PDF file ?
I have a following excel list which has the column "PDF file name" and "password", and I want to put those password for related PDF.
 
Any advice would be greatly appreciated.
 
Categories:
I have the same question (0)
  • Suggested answer
    Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at
    Hi @S140
     
    There is no direct action to protect the pdf file in Power Automate desktop and in Power Automate cloud- there are actions to secure the pdf but are paid ones- 
     
    If you are planning to do via Power Automate Desktop - try below script
     
    Dim objWord, objDoc
    Dim inputPDF, outputPDF, password
    
    ' Set file paths
    inputPDF = "C:\Users\XYZ\OneDrive - MSFT\Document_Folder\Adatum 6.pdf"
    outputPDF = "C:\Users\XYZ\OneDrive - MSFT\Document_Folder\Adatum 6.pdf"
    password = "MySecurePassword"
    
    ' Create Word Application object
    Set objWord = CreateObject("Word.Application")
    objWord.Visible = False ' Run in the background
    
    ' Open the PDF in Word
    Set objDoc = objWord.Documents.Open(inputPDF)
    
    ' Save as PDF with encryption
    objDoc.SaveAs2 outputPDF, 17, False, "", True, False, password
    
    ' Close and clean up
    objDoc.Close False
    objWord.Quit
    
    Set objDoc = Nothing
    Set objWord = Nothing
     
     
     
    Try and let me know if above script works !
     

    Thanks & Regards,
    Nived N

    Stay connected:
    LinkedIn | YouTube | Blogs

    Was this answer helpful?
    If yes, please mark it as the solution by selecting the checkbox in the discussion thread.
    Your feedback motivates me to keep contributing. Thank you!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard