Hey Manish,
Are you using the Word VBO to export to PDF? If so, I am afraid there is no way to password protect the PDF. Office's Object Model does not support encrypting PDF on export that can be called leveraged in the VBO, as can be seen at
https://docs.microsoft.com/en-us/office/vba/api/word.document.exportasfixedformat.
Since yours is a specific use case, I'll suggest spying all necessary elements of the Word application and then using them as part of your automation to specify Encrypt options and the password.
The process is
File > Save As > More Options... > Save as type: PDF (*.pdf) > Options... > Encrypt the document with a password > OK > Enter password > Re-enter password > OK > Save
I tried spying the elements and was successfully able to do so using UI Automation and Accessibility modes. I will suggest Accessibility mode as I found it to work better.
Hope this helps.
Regards.
------------------------------
Madhur Chopra
Sr. Product Consultant
Blue Prism - Professional Services
America/Los_Angeles
------------------------------