![]() |
Creating Macro to Unprotect and unhide
Hi,
I am not very technically minded but I am trying to create a macro to unprotect a workbook and then unhide hidden worksheets. The workbook is password protected so only certain users with the password should be able to execute this macro. Any assistance with how I should do this would be apprciated. Mandy |
Creating Macro to Unprotect and unhide
Why don't you post the code you have so far? If you have none using the
macro recorder is a good way to start. -- Jim "Mandy" wrote in message ... | Hi, | | I am not very technically minded but I am trying to create a macro to | unprotect a workbook and then unhide hidden worksheets. The workbook is | password protected so only certain users with the password should be able to | execute this macro. Any assistance with how I should do this would be | apprciated. | | Mandy |
Creating Macro to Unprotect and unhide
First, be aware that the workbook protection (tools|protection|protect workbook
in xl2003 menus) is easily broken. So if you have information that you don't want anyone to see, then don't trust this kind of protection. Same with worksheet protection, too. Second, you could try this code: Option Explicit Sub testme() Dim sh As Object If ActiveWorkbook.ProtectStructure = True _ Or ActiveWorkbook.ProtectWindows = True Then On Error Resume Next Application.Dialogs(xlDialogWorkbookProtect).Show If Err.Number < 0 Then Err.Clear MsgBox "You don't know the password--I'm quitting!" Exit Sub End If End If For Each sh In ActiveWorkbook.Sheets sh.Visible = xlSheetVisible Next End Sub If you're new to macros: Debra Dalgleish has some notes how to implement macros he http://www.contextures.com/xlvba01.html David McRitchie has an intro to macros: http://www.mvps.org/dmcritchie/excel/getstarted.htm Ron de Bruin's intro to macros: http://www.rondebruin.nl/code.htm (General, Regular and Standard modules all describe the same thing.) Mandy wrote: Hi, I am not very technically minded but I am trying to create a macro to unprotect a workbook and then unhide hidden worksheets. The workbook is password protected so only certain users with the password should be able to execute this macro. Any assistance with how I should do this would be apprciated. Mandy -- Dave Peterson |
All times are GMT +1. The time now is 01:39 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com