Лист защиты паролем: код VBA для защиты листа паролем при закрытии

Код VBA для защиты листа паролем при закрытии
Оглавление

Password Protect Worksheet on Close with VBA (with Images)

Что это:

When you want others to only view the workbook data and no editing should be permitted then you have to make sure you protect the workbook with password while closing it. So that even if someone tries to edit the data it will ask for the password unless they input the password data will not be editable.

The manual way of doing the same is

ОбзорProtect Sheet and then Сохранять workbook.

Password Protect

Почему это:

If you make frequent updates in the workbook then Every time when you make changes in the workbook you have to make sure you protect it while closing. Some day if you forget to protect then the data will be editable by others.

The below VBA code will help you to protect the workbook automatically while closing the workbook. That means you don’t have to protect it manually everything when you make changes in the workbook.

Как to password protect with VBA upon Close:

Step 1: Open the workbook that need to be protected and press Alt + F11




Шаг 2. Скопируйте и вставьте приведенный ниже код в окно редактора VBA и сохраните книгу.

Private Sub Workbook_BeforeClose(Cancel As Boolean)

Sheets(“Sheet1″).Protect Password:=”Your Password Here”   ‘Replace “Sheet1” with your sheet name and “Your Password Here” with the password of your choice.

ActiveWorkbook.Save

Конец субтитра

Примечание: Workbook should be saved in a macro enabled format (.xlm, .xlsm, .xlsb etc.) also make sure you protect the VBA code as well. 🙂

That’s It Now Onward your Data will be Safe Always!!

Picture of Anson Antony
Энсон Энтони
Энсон — соавтор и основатель компании www.askeygeek.com. Изучение чего-то нового всегда было его страстью, а ASKEYGEEK.com — результат его страсти к технологиям и бизнесу. Он имеет десятилетний разносторонний опыт в области аутсорсинга бизнес-процессов, финансов и бухгалтерского учета, информационных технологий, операционного совершенствования и бизнес-аналитики. За время своего пребывания в должности он работал в таких организациях, как Genpact, Hewlett Packard, M*Modal и Capgemini, занимая различные должности и обязанности. Помимо бизнеса и технологий, он любитель кино, который часами вместе смотрит и изучает кино, а также кинорежиссер!

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

Поздравляем!
Ты сделал это,
Не закрывайтесь!

Вставай 60 000 Кредиты на персонажей UberTTS бесплатно!!!

Это всплывающее окно не покажет вам решать снова!!!

УберТТС
Share to...