0

I'm working on an excel file, and i did a workbook_open event that show a input box to make the user enter a specific password (because each password open certain part of the file) but i have a problem that if the user doesn't enabled macro, he can see all the information in the file, so I'm looking for a way to prevent the user from read or use the file if he doesn't enabled macro.

aynber
  • 22,380
  • 8
  • 50
  • 63
  • The only way you can really handle this is to hide the worksheets before close, and have your code unhide them if the password is entered correctly. Eg. https://www.dummies.com/software/microsoft-office/excel/forcing-your-clients-to-enable-excel-macros/ – Tim Williams Aug 15 '21 at 21:42

1 Answers1

0

it may be possible to protect Excel spreadsheets and this VBA code will remove the protection:

enter code here Workbooks("salary ").Worksheets("data").UnProtect Password:="xyz"

I'm afraid a password is not good enough protection for your file, See this link: Decoding a password that protects an Excel file(The site is not in English)

Yaacov
  • 1
  • 3