Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Unprotecting the VBProject

I'm trying to set the .CodeName property of a worksheet, and I do it this way

Dim wks as Workshee
Dim sCodeName as Strin

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

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Unprotecting the VBProject

Thanks for the prompt, definitive response

That really sucks. Do you know what the rationale is for that rule

This is a bummer because I'm required to protect the project with a password, but I have been relying on the .CodeName property of the sheets in various places (I create a kind of custom sheet property with a prefix in the .CodeName). I suppose I could come up with another mechanism for storing that custom sheet property, like a name. And then let the .CodeName be however it defaults. It's still a bummer that I can't control the .CodeName, I like to have everything neat and organized. Oh well

Thanks again

James
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 115
Default Unprotecting the VBProject

James -

Do you know what the rationale is for that rule?


Macro virus protection.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Unprotecting the VBProject

I can see how unprotecting other projects creates virus vulnerability, but unprotecting Me, Myself, whatever you want to call the project that's running the unprotect code, when I have a the password available, that seems like overkill or a shotgun approach to virus protection that closes one too many doors.

Oh well, thanks for the info. I figured it was probably protection against malice of some sort.

---
James
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
Replacing Text In VBProject Module Charles Excel Programming 10 February 28th 04 01:22 AM
Documentation for VBProject Wes Jester Excel Programming 2 September 30th 03 06:26 PM
VBProject events? Marc R. Bertrand Excel Programming 1 September 14th 03 04:12 PM
problem with wkbk.VBProject.VBComponent Rich[_14_] Excel Programming 0 September 11th 03 07:34 PM
VBProject events? Chip Pearson Excel Programming 0 September 10th 03 10:36 AM


All times are GMT +1. The time now is 11:10 PM.

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

About Us

"It's about Microsoft Excel"