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


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default 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
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
Macro to Protect OK, Unprotect now messed up! Stilla Excel Worksheet Functions 12 January 7th 09 02:22 PM
unprotect sheet macro belvy123 Excel Discussion (Misc queries) 2 March 27th 08 10:36 PM
unprotect sheet macro belvy123 Excel Discussion (Misc queries) 1 March 27th 08 10:32 PM
How to unprotect a workbook by macro? FARAZ QURESHI Excel Discussion (Misc queries) 4 December 29th 06 12:27 AM
Macro to Unprotect sheet!? Neo1 Excel Worksheet Functions 5 March 28th 06 05:50 PM


All times are GMT +1. The time now is 02:38 PM.

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

About Us

"It's about Microsoft Excel"