Hello

I was wnderign if you could troubleshoot the following lines of VBA COde I have in my module.

While generating a working copy of the excel file from a Template I want certain Modules to be deleted. While, sometimes the code is working, on some other machines or some other time it does not. Do I need to add a PAUSE for a few seconds in VBA code so the lines get execuited or is there a better way to achive the code to work ?
On Error Resume Next
    Application.VBE.ActiveVBProject.VBComponents("ThisWorkbook").CodeModule.DeleteLines 1, Application.VBE.ActiveVBProject.VBComponents("ThisWorkbook").CodeModule.CountOfLines
    RemoveVBComponents ThisWorkbook.VBProject, "AutoOpen"
Code in "RemoveVBComponents" Macro
Sub RemoveVBComponents(VBProject As Object, ParamArray ComponentNames() As Variant)
    Dim Item
    For Each Item In ComponentNames
        On Error Resume Next
        VBProject.VBComponents.Remove ThisWorkbook.VBProject.VBComponents(Item)
        On Error GoTo 0
    Next
End Sub
Code in "ThisWorkbook"
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    If Not SaveAsUI Then
        Cancel = True
        MsgBox "You cannot save this Master Template. Create your OWN record as working copy", vbInformation, "Template Master"
    End If
End Sub
Code in "AutoOpen" Module
Sub auto_open()
    Application.WindowState = xlMaximized
    Sheets("Lookup").Select
    MsgBox Prompt:="Hello " & Excel.Application.UserName & "." & VBA.Constants.vbNewLine & Chr(13) & "Please check if your team members exist in the Lookup Data" & vbCrLf & "If not please use Add Team Member Button to update this Master list.", _
           Title:="Check Team memebr Exists ?"
    Application.Calculation = xlAutomatic
End Sub
Grateful for any support and help/guidance.

Kind regards
Vivek