Sabtu, 03 Januari 2015

RE: [ExcelVBA] Re: Stopping calculation and iterations before save.


Microsoft Help specifies the following:

Private Sub Workbook_BeforeSave (SaveAsUI, Cancel)




True if the Save As dialog box will be displayed.




False when the event occurs. If the event procedure sets this argument to True, the workbook isn't saved when the procedure is finished.

More than once I have to prevent saving a document because some conditions were not met. So If condition is not met then put True as second parameter. If SaveAsUI = True the SaveAs dialog box is shown.


From: []
Sent: Sunday, 4 January 2015 11:32 AM
Subject: [ExcelVBA] Re: Stopping calculation and iterations before save.

Sorry about the previous code:

I copied it from a previous text that I had written outside of Excel.

Private Sub Workbook_BeforeSave()

provokes an compiling error.

The code that does not work is written in my Workbook as:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _

Cancel as Boolean)

With Application
.Iteration = False
.Calculation = xlManual
.CalculateBeforeSave = False
End With

End Sub

By the way, I do not quite understand why the parameters are required.

[Non-text portions of this message have been removed]


Posted by: "Daniel Lamarche" <>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: to enter the ezine, then search the ARCHIVES for EXCEL VBA.

Visit our ExcelVBA group home page for more info and support files:

More free tutorials and resources available at:




Tidak ada komentar:

Posting Komentar