PDF Security & Access Issues

How to Create Password-Protected PDFs from Microsoft Access VBA

Steve KSteve K Oct 28, 2026 873 views

Question details

The user needs to automate the generation of PDF files from Microsoft Access reports and apply editing restrictions or password protection using VBA.

How to Create Password-Protected PDFs from Microsoft Access VBA
Product
Microsoft Access and Adobe Acrobat
Device & OS
not provided
Scenario
Automating report generation workflows where output documents must be secured with passwords and permission controls before distribution.
Observed behavior
Adobe Acrobat lacks a straightforward, built-in VBA command to comprehensively apply PDF security settings directly from MS Access.
Before you start

Before attempting to automate PDF security, ensure you have access to a C/C++ development environment and the Adobe Acrobat SDK, as native VBA commands are insufficient for applying full document restrictions.

Solution 1Recommended

Develop a Custom Acrobat Plug-in Using C or C++

Since standard VBA cannot apply advanced PDF security settings natively through Acrobat, building a custom intermediary plug-in is the recommended approach to bridge this gap.

Adobe Acrobat's OLE interface does not expose straightforward VBA commands for injecting complex security protocols, such as user passwords and strict editing restrictions, during the PDF creation process.

To achieve this level of automation from Microsoft Access, you must build a custom C or C++ plug-in using the Acrobat SDK. This plug-in handles the PDF, applies the necessary security policies, and saves the restricted file, which can then be triggered by your Access VBA script.

1
Install the Acrobat SDK

Download and install the Adobe Acrobat SDK and configure your preferred C/C++ development environment, such as Microsoft Visual Studio.

2
Write the Security Plug-in

Develop a custom plug-in that utilizes Acrobat's core API to apply password-based permissions and editing restrictions to a specified PDF document.

3
Expose the Interface

Configure the plug-in to be callable via an OLE automation server or a command-line interface so that external scripts can interact with it.

4
Integrate with Access VBA

In your Microsoft Access VBA editor, write a script to generate the standard PDF report, then execute a call to your custom C/C++ plug-in to apply the passwords and save the secured file.

Develop a Custom Acrobat Plug-in Using C or C++
Development Requirements: Creating a C++ plug-in requires advanced programming knowledge, familiarity with the Acrobat SDK architecture, and a valid Acrobat Pro license for testing.
Free Microsoft Office alternative

Secure Your Documents Easily with WPS Office

If building custom C++ plug-ins for Microsoft Access and Adobe Acrobat is too complex for your workflow, consider using WPS Office. WPS Office is a lightweight, free alternative that allows you to easily create, edit, and encrypt documents and PDFs without writing a single line of code. It offers full compatibility with Microsoft Office formats and features intuitive, built-in security tools.

  1. 1. Open Your Document: Launch WPS Office and open the document or PDF you wish to secure.
  2. 2. Access Protection Tools: Navigate to the 'Protect' tab located on the top ribbon menu.
  3. 3. Apply a Password: Click on 'Encrypt', enter your desired password, configure the editing permissions, and save the file.
Built-in PDF password protection and editing restrictions accessible directly from the UI.Seamlessly compatible with Microsoft Word, Excel, and PowerPoint file formats.Lightweight installation with an intuitive, familiar interface.Completely free to download and use for essential daily office tasks.
microsoft office alternative - wps office

Frequently Asked Questions

Can I protect a PDF directly using only MS Access VBA and Acrobat Reader?

No, Adobe Acrobat Reader does not support PDF editing, creation, or security configuration. You need a licensed version of Acrobat Pro, and even then, native VBA commands are insufficient for applying full security settings without a custom plug-in.

Are there third-party tools I can call from VBA instead of writing a C++ plug-in?

Yes. Instead of building a C++ plug-in, you can use the VBA 'Shell' function to execute third-party command-line PDF utilities (such as PDFtk or Ghostscript) to apply passwords to a PDF generated by MS Access.

Does WPS Office support macros for automating document protection?

WPS Office Pro supports VBA and macros, allowing users to automate various document generation tasks. However, for applying robust PDF passwords, using the built-in encryption feature in the WPS user interface is the easiest and most reliable method.