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

Announcements

News and Announcements icon
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,136 Super User 2026 Season 1 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 605

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard