How to Password Protect PDF Files using VBA
Вставка
- Опубліковано 7 лип 2021
- This is probably one of the most requested topics I got from my mail merge automation video. In this tutorial, we are going to look at how to use VBA in Excel to password protect a list of PDF files.
Download the command line encryption tool: learndataanalysis.org/pdf-enc...
Buy Me a Coffee? Your support is much appreciated!
-------------------------------------------------------------------------------------
🔑PayPal Me: www.paypal.me/jiejenn/5
🔑Venmo: @Jie-Jenn
💼Join Robinhood with my link and we'll both get a free stock 🤝 join.robinhood.com/jiej6
Support my channel so I can continue making free contents
---------------------------------------------------------------------------------------------------------------
Patreon: / jiejenn
By shopping on Amazon → amzn.to/2JkGeMD
More tutorial videos on my website → LearnDataAnalysis.org
Business Inquiring: UA-cam@LearnDataAnalysis.org
#VBA #PDF #Encryption
There is a space after the exe path. ".exe " -> yes
".exe" -> no
This is very helpful, thank you very much for sharing
very useful. thank you
thanks, this is very useful
Very much useful
You are amazing!!! This helps me a lot! Thanks!!!
I am guessing you got your issue resolved?
Yes! I was able to solve it, you have no idea how you help me with this tutorial
I want to use your method but i cant. Excel show Error "Object doesn't support this property or method". Do you know why? I have Office 2019 Home edition.
Hi thank you for the program. However when I ran it, it does not automatically fill the PDFEncrypt menu. I need to type in. Do you know why? Thanks
Can you share the decompiled python code , I'm seeking to encrypt the pdf file with two passwords (owner and user) ?
Excellent tool and thanks for sharing. Can we use the same tool to encrypt pdf to prevent editing or copying not password to open?
I don't think that's possible as far as I know.
How to fix the Run-Time error 5 Invalid procedure called argument?
Hi! If I send the encrypted PDF files via email/telegram to many recipients, will the password work?
Thanks excellent Video but it had encrypted only one file out of 3 when I run first time and 2nd time nothing happen
Hey, can i merge this module into a separate module so that the mail merge, creation and encryption could be done together rather than seperate modules??
Sure, you can.
hi, can I use other software rather that encrypted_pdf.exe such a password tool?
Sure. If you do a Google search you should find a few 3rd party tools to encrypt PDD files.
Hi,
could you provide the source code for this please?
Hi. It shows
"Run-time error "9": Subscript out of range
When I run the macro. Please assist. Thank you!
Looks like the program cannot read your table properly.
Hi jie
Can you make a video on creation of exe file
Hi, I am receiving the message "runtime error'53': file not found". I have seen other comments where you said to specify the file location in a variable to point to the binary. Can you explain how to do that? Where should it be included in the code?
Makes sure the spaces are in the correct places.
@@jiejenn thank you for replying. The file name I entered like you did in your video. I do not know where to put the folder location.
Is it possible for vba to encrypt while exporting pdf without using third-party software
I don't think that's possible at this point. If you do find a way, do let me know and I will buy you a coffee.
I am getting Runtime Error 1004 for this code Call Shell("encrypt_pdf.exe " & Chr(34) & .Cells(row_number, “B”).Value & Chr(34) & " " & Chr(34) & .Cells(row_number, "F").Value & Chr(34), vbNormalFocus)
Can some one help me in cracking this error please
what if i have a few filepath to encrypt example: filepath 1 to filepath 6?
Update your file paths?
Hi, this looks amazing! But is it possible to apply the macro to the pdfs instead of the .exe file?
Not sure if I follow your question.
@@jiejenn uhm but you have .exe file to which u applied the macro ight? Just wanted to know if this can be replicated to pdf files directly.
The macro calls the exe file. VBA doesn't have a defaulf library to work with PDFs.
@@jiejenn I see. So it means I need to create a .exe file first?
Hi, can u help me, the application can’t working, i got notif
encrypt_pdf.exe: error: following arguments are required: password
Pls help to solve. Thank you 🙏🏻
Hi did you already solve this problem?
i put your code and download encrypt_pdf but nothing happen😢.. can u help me ?
I am getting error 9, subscript out of range. Can anyone help me???
Hi, Do you have encrypt_pdf for mac version?
Only Windows.
where can we get encrypt_pdf.exe file
Hi, I'm getting a debug error in line 5, set...kindly help I'm using office 19
Are you using Windows or MacOS?
Hi, Just add the folder path where you put file "encrypt_pdf.exe" in the call command. It will solve the problem.
E.g. Call Shell(ActiveWorkbook.Path & "\" & "encrypt_pdf.exe " & Chr(34)...
@@khanhhuynh5557 It is run but pdf output file is no password. Maybe file ecrypt_pdf is not working.
Hello sir, Is there any way to decrypt pdf password using macro, like this?
Good suggestion. Let me put up a follow up video in the future.
@@jiejenn Thank you.
Hello, I copied the code exactly written, installed the encryption tool and when I run the macro, nothing happens. I open the pdf and there is no password. Do you have any advice?
Hard to tell without looking at your code.
@@jiejenn
Code is below. Same as the video. I am saving my encrypt_pdf.exe , my excel file, and my pdf in the same path. The Call Shell("") command does not open the command line tool and when I run the command line tool, it opens quickly and immediately shuts. I even tried running as administrator.
Sub PasswordProtect()
Dim file_name As String
Dim row_number As Long, last_row As Long
Dim wsList As Worksheet
Set wsList = ThisWorkbook.Worksheets("List")
With wsList
last_row = .Cells(Rows.Count, "A").End(xlUp).Row
For row_number = 2 To lastrow
Call Shell("encrypt_pdf.exe " & Chr(34) & .Cells(row_number, "A").Value & " " & Chr(34) & .Cells(row_number, "B").Value & Chr(34), vbNormalFocus)
Next
End With
End Sub
I am not getting an error, just nothing happens and I believe someone below has had the same issue in recent months. Can you please look into this and see if it works on your end still? Would be greatly appreciated!
hi, i tried it today and i got this error "runtime error'53': file not found"
The error is pointing to Call Shell("encrypt_pdf.exe" ...
The error is due to VBA cannot locate the binary.
@@jiejenn Is there a way to let VBA to locate the binary?
You specify the file location in a variable to point to the binary.
@@jiejenn Thx for replying so fast,, it's really my first time to use VBA.. would you please tell me how to set the location in the variable?
I’m facing the same issue
Hello JieJenn, I don’t have Python Exe file & I know it will not work. How shall I get it from you?
Not sure if I understand your question.
In your video you mentioned create using python. There was an . Exe file on your video. How can I get this file ? The script won’t work without this file.
@@floalas I used Python to create the command line tool. You don't need Python to use the tool.
I don’t have the encrypt_pdf.exe. I tried to run the script got error.
Ok.
Can anyone share this code to me ?
How can I create the file of pdf.exe??Thank you.
I'm not following your question.
There is a file named of “encrypt_pdf.exe.
You mentioned that is created using Python and will share the source code in another tutorial.
Oh yeah. I haven't create the tutorial for that. Been busy.
@@jiejenn please share the tutorial for the same
@@jiejenn Hi Jie, Can you please share the Tutorial for encrypt_pdf.exe
Excellent tool! Many thanks. One thing i was wondering is why is the .exe so big, I'm guessing it's because there are a number of heavy runtimes that you need?
This tool was packaged using the old Python library called pyinstaller, which the packaging mechanism wasn't very efficient. They have since improved the packaging mechanism, and the executable file size is much smaller.
I probably need to repackage this app when I get a chance.
File not found error ??
Just tested, it is there.
@@jiejenn Yes all file are in same folder 🤔( runtime error'53': file not found)
same error here, file not found error 53
@@jiejenn Please can you help resolve this error.
Hi, Just add the folder path where you put file "encrypt_pdf.exe" in the call command. It will solve the problem.
E.g. Call Shell(ActiveWorkbook.Path & "\" & "encrypt_pdf.exe " & Chr(34)...
Can you send VBA code sir ?
Maybe type it out yourself?
Exactly Good ❤️❤️❤️ would you please give me the link for "encript_pdf.exe"
Can you send VBA code sir ?
Maybe type it out yourself?