Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Boell Fischer   on Dec 29 In MS Office Category.

  
Question Answered By: Sally Pierce   on Dec 29

I have code that will delete  the modules
(I remove the modules  and protect the worksheet when I send the final
report for distribution),
but how do you plan to determine the failed password  attempts?

Plus, what good is it to delete a single module?
Once one or more modules are removed, won't execution results become
unpredictable? If the person fat-fingers the password the first time,
but corrects his mistake the second, he'll be missing a module  and
probably needs to start over anyway...

Well.. if you can figure out the failed password, here is what I use:

Dim VBComp As VBIDE.VBComponent
Dim VBComps As VBIDE.VBComponents
For Each VBComp In VBComps
'MsgBox VBComp.name
Select Case VBComp.Type
Case vbext_ct_StdModule, vbext_ct_MSForm, _
vbext_ct_ClassModule
VBComps.Remove VBComp
Case Else
With VBComp.CodeModule
.DeleteLines 1, .CountOfLines
End With
End Select
Next VBComp

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Self distruction when someone trying to open VBA module Or get search suggestion and latest updates.


Tagged: