View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Intentionally not validate Sub or Function

Having the password in the unprotected code module should be no more
problematic than depending on the password in the first place. If the
password works, then having it in the unprotected module should be equally
secure.

If it causes you concern, then build an algorithm to scramble and unscramble
the password so the visible password is a scrambled version of the password.

Certainly easier than the path you are headed down.

--
Regards,
Tom Ogilvy




"Troubled User" wrote:

Jim,

Yes. I need to copy multiple sheets (all the visible sheets) from one file
to a new file and preserve the names, references, etc.... The problem is
that there is code in the deactivate event on some of the pages.

I understand that the correct way to solve this problem is to move
everything off the page going through the workbook page by page and then
rename all the tabs accordingly. Seeing as I already have code that moves
everthing the way I want it except for when there is code in the deactivate
event, I thought maybe I could write something that would simply step over
the code that cause it to crash when it is in the new file.

I have also tried to move all the code to the page (not call a sub) and it
will compile. Problem in this case is that there is some hard-coded
passwords for unlocking. I could get away with that if I could
programmatically secure the new workbook. Any ideas???

Thanks in advance.





"Jim Thomlinson" wrote:

I'm lost. RunTheSub is only executed if range "test" = "master". Otherwise ti
si not executed. Are you saying that there is no sub called RuntheSub so the
code will not compile but you would like to run it anyways?
--
HTH...

Jim Thomlinson


"Troubled User" wrote:

Is there anyway to write a Sub and step over or not evaluate the contained
Subs unless they are called. For example, in the following case I don't want
the system to look for the Sub named RuntheSub unless it is needed (passes
the if statement).

Private Sub Worksheet_Deactivate()
On Error Resume Next
If ShtTest.Range("Test") = "master" Then

RuntheSub

Else
End If
End Sub