View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
michelr michelr is offline
external usenet poster
 
Posts: 1
Default Password protection with grouping causes error 1004


Hi,

I have the followiing macro in ThisWorkbook (suggested in anothe
topic) to allow grouping and ungrouping in a password protected file.

Sub WorkBook_Open()
Application.ScreenUpdating = False
Dim n As Single
For n = 1 To Sheets.Count
With Sheets(n)
.Protect Password:="test", userinterfaceonly:=True
.EnableOutlining = True
.EnableAutoFilter = True
End With
Next n
Application.ScreenUpdating = True
End Sub

When i apply it to an excel 2000 file it works perfectly. But when
want to open the file in excel 2003 it gives an error:

-Run-time error 1004: The password you supplied is not correct. Verif
that the caps lock is off etc.etc.-

This starts with the worksheets that use grouping. The other sheet
before that sheet (with no grouping) are all password protected wit
the correct password.

Can anybody help? I'm new to macro's...

Thanx!

Miche

--
michel
-----------------------------------------------------------------------
michelr's Profile: http://www.excelforum.com/member.php...fo&userid=3437
View this thread: http://www.excelforum.com/showthread.php?threadid=54148