Ed,
In this case, Cancel would be a Boolean (True or False) argument. It usually
pertains to event code and the Cancel argument allows the event to be
cancelled. So by setting Cancel to True, that event gets cancelled.
An example is this
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
If Range("A1") = "" Then
MsgBox "Must enter value"
Cancel = True
End If
End Sub
This code is invoked if the workbook save button is invoked. It tests A1 for
data, and if there is none, displays a message, and sets the Cancel
argument. Net effect, the workbook deosn't get saved, as the event is
cancelled.
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"universal " wrote in message
...
Apologies if this is a simplistic question, but in order to help my
understanding of the macros that Ive been butchering and then adding
together, like a poor mans' Dr Frankenstein, I wondered what this
meant.
Cancel = True (and indeed Cancel = False) statements are littered
across some macros that I am using, before and after functions, and
dialogue boxes.
I wonder if anyone could explain how this actually works and what it
refers to, and when it should be used?
Many thanks for everybodies continued understanding & patience,
Ed
---
Message posted from http://www.ExcelForum.com/