Barb wrote:
<< I'm not sure how the CANCEL works.>>
From the Excel topic for the Workbook_BeforeSave event:
"If the event procedure sets this argument to True, the workbook isn't
saved when the procedure is finished."
Most events have this Cancel argument. It is used by the VBA programmer
(you) to tell Excel whether you want it to go ahead and run the normal
routine after your event handler has finished or not. Usually, you
simply want to intercept the function, insert some customized activity
of some sort, then continue with the normal Excel action. But sometimes,
you decide that you want to skip the rest of the default Excel behavior
for some reason. For example, you might want to skip Saving the
workbook, if the user had not selected the "SaveAs" command to give the
workbook a new name after making some changes. In this case, in the Else
part of the If statement, you would set Cancel to TRUE after displaying
the message box. This would force the user to use SaveAs and rename the
workbook while saving it. You would want to be sure to display a very
clear message that the workbook has NOT been saved!