Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default 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/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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/

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Run Macros in a Password-protected workbook? JRSCEI Excel Discussion (Misc queries) 1 January 9th 10 10:27 PM
How to retrive password protected worksheet but forgot password? Laurie Excel Worksheet Functions 1 November 19th 09 09:42 PM
Macros will not run in a password protected file office 2007 pro Josh C Excel Discussion (Misc queries) 0 November 28th 07 08:13 PM
Password protected worksheet GARY Excel Discussion (Misc queries) 2 September 18th 07 07:24 AM
Delete Password protected macros Matt[_26_] Excel Programming 2 December 21st 04 01:20 PM


All times are GMT +1. The time now is 07:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"