宏代码:
Public Function is_wp() Debug.Print "Application.Build:" & vbCrLf & Application.Build Debug.Print "Application.Caption:" & vbCrLf & Application.Caption Debug.Print "Application.ActiveWorkbook.Name:" & vbCrLf & Application.ActiveWorkbook.Name is_wp = InStr(Replace(UCase(Application.Caption), UCase(Application.ActiveWorkbook.Name), ""), "WPS") > 0 If Application.Caption <> "工作人员通讯录.xlsm - Excel" Then ActiveWorkbook.Close Savechanges:=False End If
Private Sub Workbook_Open() Call Sheet1.is_wp Call Sheet1.main End Sub