Dim WBname strPath = "C:\Documents and Settings\1"Set objExcel = CreateObject("Excel.Application")
objExcel.DisplayAlerts = False
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set FileList = objWMIService.ExecQuery ("ASSOCIATORS OF {Win32_Directory.Name='" & strPath & "'} Where " & "ResultClass = CIM_DataFile")
For Each objFile In FileList
    If objFile.Extension = "xls" Then
        UpdateFile objFile.Name
    End If
Next
objExcel.QuitSub UpdateFile(strXlsFile)
 '   On Error Resume Next
    Set objWorkbook = objExcel.Workbooks.Open(strXlsFile,,,,strOldPassword,strOldWritePassword,True)
    For Each WBname In objWorkbook.Names
    If Not WBname.Name Like "*!Print_Area" And _
        Not WBname.Name Like "*!Print_Titles" Then
        WBname.Delete
    End If
    Next    objWorkbook.Save
    objWorkbook.Close
End Sub