我有這個工作簿,我想讓它看起來像一個程序。 我也希望使用它的人只能通過特定的命令按鈕退出應用程序。僅通過VBA關閉應用程序
這裏是我的代碼有
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnKey "{ESC}"
Cancel = True
MsgBox "Please use the QUIT button to save and close the database."
End Sub
而對於退出按鈕:
Sub SAVE_CLOSE
ActiveWorkbook.Save
If Workbooks.Count < 2 Then
Application.Quit
Else
ActiveWorkbook.Close
End If
End Sub
我的問題是,當用戶退出通過這個按鈕的應用程序,它觸發私人小組Workbook_BeforeClose事件並取消退出過程。你會如何解決這個問題?
謝謝!
哦,嘿,我正在打字,但有例子!尼斯。 :) – steegness
工作就像一個魅力!謝謝! – Alex