View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Unprotecting the VBProject

There is no programmatic way to unprotect a VBProject. The only
way is via the dialog box.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"jstrater" wrote in message
...
I'm trying to set the .CodeName property of a worksheet, and I

do it this way:

Dim wks as Worksheet
Dim sCodeName as String

Thisworkbook.VBProject.VBComponents(wks.CodeName). Name =

sCodeName

This works, unless the VBProject is password protected. Now

the code knows its own password, so to speak. It's declared in
a module as a public constant. But the VBProject.Protection
property appears to be read-only. I can't get this to work from
inside VBA. Note: I'm doing this in Excel '97, I hope that's not
my problem. There has to be a way to do this, doesn't there?

James