关闭excel 2016后我得到一个死空白的窗口?

时间:2017-04-06 14:05:29

标签: excel vba excel-vba excel-2016

我的代码运行正常,直到我关闭工作簿。这是我的代码:

.....
    With olMail
        .Subject = "Hi " & ActiveWorkbook.Name
        .Body = strSubject
        .Attachments.Add ActiveWorkbook.Path & "\" & ActiveWorkbook.Name
        .display
    End With
    Set olApp = Nothing
    Set olNameSpace = Nothing
    Set olMail = Nothing
    Application.ScreenUpdating = True

    ActiveWorkbook.Save
    ActiveWorkbook.Saved = True
    DoEvents
    ActiveWorkbook.Close <<<<===== I see the BLANK EXCEL WINDOW HERE!
    Application.EnableEvents = True
    Exit Sub

我不确定这是否是excel 2016的错误,但这是excel的整个窗口,它缺少功能区:

enter image description here

1 个答案:

答案 0 :(得分:1)

这是因为您关闭了工作簿而不是应用程序。

使用Application.Quit