Attribute VB_Name = "模块1" Private Sub CommandButton1_Click() Dim custom As String 'Cells(1, 25) = Environ("USERNAME") 'Range("C1").Select 'Customer = ActiveCell.FormulaR1C1 'If Customer = "" Then 'MsgBox "请输入顾客型号", vbCritical, "错误提示" 'Exit Sub 'End If Range("C8").Select Arrange = UCase(ActiveCell.FormulaR1C1) 'Range("C3").Select 'Made = ActiveCell.FormulaR1C1 'If Made = "" Then 'MsgBox "请输入编写人", vbCritical, "错误提示" 'Exit Sub 'End If 'Range("C4").Select 'chk = ActiveCell.FormulaR1C1 'If chk = "" Then 'MsgBox "请输入审核人", vbCritical, "错误提示" 'Exit Sub 'End If If Trim(Arrange) = "" Then MsgBox "没有产品编号", vbCritical, "错误提示" Exit Sub End If If Len(Trim(Arrange)) <> 10 Then MsgBox "产品编号不等于10位", vbCritical, "错误提示" Exit Sub End If If Arrange <> "" And Len(Trim(Arrange)) = 10 Then custom = UCase(Mid(Arrange, 2, 4)) If custom = "E000" Or custom = "V2G6" Or custom = "C001" Or custom = "A490" Or custom = "V254" Or custom = "V2D1" Or custom = "V2MC" Or custom = "V2EZ" Then MsgBox "请使用" + custom + "的确认模板", vbCritical, "错误提示" GoTo end1 End If Application.CommandBars("Control Toolbox").Visible = True ActiveSheet.Shapes("CommandButton1").Select Selection.Delete Application.CommandBars("Control Toolbox").Visible = False Range("B8:B10").Select ActiveWorkbook.SaveAs Filename:="e:\wjys\EQ-" + Arrange + ".xls", FileFormat:=xlNormal _ , Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False Application.Quit End If end1: 'Cells(3, 3) = Cells(2, 25) End Sub