Help protecting spreadsheet with password from code

L

lanem

I'm trying to protect spreadsheet from code. I can get it to protect, but I
can't get it to protect with a password. Here's my code:

Dim xl As New Spreadsheet
xl.ActiveSheet.Protect("testpassword")

Thanks for your help.
 
L

lanem

This is the error I get:

System.Runtime.InteropServices.COMException: Exception from HRESULT:
0xE0040059
 
K

Karl E. Peterson

lanem said:
This is the error I get:

System.Runtime.InteropServices.COMException: Exception from HRESULT:
0xE0040059

That's definitely not VBA...
 
Top