ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How could I run my macros in a protected with password worksheet (https://www.excelbanter.com/excel-programming/307403-how-could-i-run-my-macros-protected-password-worksheet.html)

jose luis

How could I run my macros in a protected with password worksheet
 
Hi everyone!,

I am building an small application where I want the data in a workshee
be protected with a password and still be capable to run macros (Exce
2000). I been reading the messages in this forum and i get the idea t
include the protect / Unprotect instruction in the macro
(ActiveWorkbook.Unprotect Password:="abcd"). I already did that but i
doesn“t work (error 1004).

Could you give me a hand?

Thank you all.

Jos

--
Message posted from http://www.ExcelForum.com


DavidC[_2_]

How could I run my macros in a protected with password worksheet
 
The macros will still work generally when a workbook nis
protected. It is only when your try and run a command in
VBA which is not available to run when the workbook is
protected that the macro will fail. An example of this is
conditional formatting. If you protect a workbook and try
and add conditional formatting through the menu it will ot
let you. An so with VBA the commands for those same
things will not run in VBA either. If a command runs
normally off the menu when the workbook is protected then
it should run in VBA.

If you really do need to protect and unprotect on the run
then try these:

Private Sub unprotect_cells()

ActiveWorkbook.UnprotectSharing ("xxx")
ActiveSheet.Unprotect ("xxx")

End Sub

Private Sub protect_sheet()

Dim wrkbk As String

ActiveSheet.Protect ("xxxx")
wrkbk = ThisWorkbook.Name


End Sub

BOL
David C
-----Original Message-----
Hi everyone!,

I am building an small application where I want the data

in a worksheet
be protected with a password and still be capable to run

macros (Excel
2000). I been reading the messages in this forum and i

get the idea to
include the protect / Unprotect instruction in the macro
(ActiveWorkbook.Unprotect Password:="abcd"). I already

did that but it
doesn“t work (error 1004).

Could you give me a hand?

Thank you all.

Jose


---
Message posted from http://www.ExcelForum.com/

.


jose luis

How could I run my macros in a protected with password worksheet
 
Thank you David for your prompt response. I “ll try your solution and
Let you know.

See you around

Josč Luis


---
Message posted from http://www.ExcelForum.com/



All times are GMT +1. The time now is 09:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com