Hi all - - I found this code that should copye ThisWorkbook Object from one workbook to other workbooks. As I test this out I'm getting an run time error I thought someone might have an idea on how I can get round/fix this? The line I have the error is in red.


Sub ReplaceThisWorkbookProcedures()
     'Application. EnableEvents to false
    Dim N As Long
    Dim NewCode As String
    Dim Master_WB As Workbook
     'ThisWorkbook is the file containing the new ThisWorkbook procedures
     
    Workbooks.Open ("C:\Documents and Settings\jwhite7\Desktop\CurrentEEList\DirectorAboveVBA\Sheet1.xlsm")
    Set Master_WB = ThisWorkbook
    With ActiveWorkbook.VBProject.VBComponents("ThisWorkbook").CodeModule
         
        NewCode = .Lines(1, .countoflines)
         
    End With
     
     'open all files you want the new procs in
    With Application
        .ScreenUpdating = False
        .DisplayAlerts = False
        .EnableEvents = False
       With .FileSearch '>>>>>ERRORS HERE with Run Time Error 445 Object dosen't support this action            .LookIn = "C:\Documents and Settings\jwhite7\Desktop\CurrentEEList\DirectorTESTcopyCode"
            .FileName = "*.xls"
            If .Execute > 0 Then
                For N = 1 To .FoundFiles.Count
                    If .FoundFiles(N) <> Master_WB.FullName Then
                        Workbooks.Open(.FoundFiles(N)).Activate
                        Sheets("Actual").Unprotect ("1015")
                         '--------Delete old procedures and replace with new--------
                        With ActiveWorkbook.VBProject.VBComponents("ThisWorkbook").CodeModule
                            .DeleteLines 1, .countoflines
                            .InsertLines 1, NewCode
                        End With
                         '-----------------------------------------------------------------
                        ActiveWorkbook.Close savechanges:=True
                    End If
                Next
            End If
        End With
        .ScreenUpdating = True
        .DisplayAlerts = True
    End With
     
End Sub