Excel Icon

Valid XHTML 1.0!

Valid CSS!


AppWrapper

Takes the headache out of managing code in multiple workbooks

AppWrapper catches all occurrences of events that trigger in Excel, regardless of the workbook that is open. Once the addin is loaded, every Sheet_Change or Workbook_Open that occurs passes through this addin too, allowing you to have code in one place, not hundreds of workbooks.

This VBAProject has been protected with a password of "a" without the quotes.This is to prevent it from opening every time you open the VBE.

If events are coded into your workbook that duplicate the events in AppWrapper, your workbook events will fire first, followed by the events in AppWrapper. You can apply conditions to the events in AppWrapper to ensure they fire only as and when you require, eg:

You need to check the value in cell A1 in the first sheet of the workbook equals "Core Index", but only when the workbook name begins with the phrase "OPEX Implication". You have 600 workbooks beginning "Core Implication", adding the code to each is a headache and if you decide it should be "Core Indicies" you have 600 versions of the code to maintain.

In AppWrapper, you could have the following code in the clsXlApp class


Private Sub  xlApp_SheetActivate(ByVal Sh As Object)  
    
If Left(ActiveWorkbook.Name, 16) = "OPEX Implication" Then  
    
If Sh.Index = 1 Then Sh.Range("a1") = "Core Index"  
    
End If  
End Sub


Or perhaps more efficiently:

Private Sub xlApp_WorkbookOpen(ByVal Wb As Workbook)  
If Left(Wb.Name, 16) = "OPEX Implication" Then _
 Wb.Worksheets(1).Range("a1") = "Core Index"  
End Sub 


The choice is yours.

.

.