4 在弹出窗口内粘贴以下内容:(加粗部分改掉,改成要删除宏的文件名) Sub RmvMacros() Dim wbk As Workbook Dim strFilename As String strFilename = Application.GetOpenFilename(Excel 文件 (*.xls;*.xlsx),*.xls;*.xlsx) '要删除宏的文件名 If strFilename = False Then Exit Sub Application.EnableEvents = False '禁止在打开时触发事件 Application.DisplayAlerts = False Set wbk = Workbooks.Open(strFilename) For Each sht In wbk.Sheets sht.Visible = True If sht.Type = 3 Or sht.Type = 4 Then sht.Delete Next For i = wbk.Names.Count To 1 Step -1 If wbk.Names(i).Visible = False Then wbk.Names(i).Delete Next i wbk.Close savechanges:=True Application.DisplayAlerts = True Application.EnableEvents = True End Sub