Security Excel

Orkit 45 Reputation points
2025-01-15T22:08:56.6533333+00:00

After browsing several forums, I find that the only real security for an Excel file is encryption with a password. Unfortunately, a person who knows the password can change it after having access to the file. Is it possible with VBA to put a password in the case of encryption so that even if one user changes the password, the correct password overrides the other?

I saw this:

Sub SetPasswordOptions()

ActiveWorkbook.SetPasswordEncryptionOptions _

PasswordEncryptionProvider:="Microsoft RSA SChannel Cryptographic Provider", _

PasswordEncryptionAlgorithm:="RC4", _

PasswordEncryptionKeyLength:=56, _

PasswordEncryptionFileProperties:=True

End Sub

But I don’t know where to put the password I want to impose.

Thank you in advance.

The security settings of Excel files must evolve, in particular passwords on the workbook and on sheets that are visibly easy to hack just with sheets for example!

Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
2,088 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
4,158 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Jiajing Hua-MFST 13,135 Reputation points Microsoft Vendor
    2025-01-16T07:53:05.8966667+00:00

    Hi @Orkit

    There is no way in Excel to enforce a fixed password that cannot be changed by other users.

    You can use VBA to add another layer of password protection when users open a file, but VBA itself cannot prevent someone from changing the password after they have access to the file.

    Maybe you need to check whether there is a third-party encryption software that can meet your needs.

    Thanks for your understanding.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.