bool = FindNextHolidayOnDate(nDate,nHolSet)
This macro function will test if there is a Holiday on date nDate for the Holidays Set nHolSet, and with the holidays table's cursor positioned where it currently is (see below). If a holiday is found the holidays table is moved to the next record. This function is part of a set of advanced functions that give you direct access to the holidays tables (see Using Built-in Holidays Functions).
Three important points about this function :
•This function does not look for One-Time-Dates.
•This function moves to the next record in the table that matches the date and Holidays Set. The result of this function depends on what happened to the holidays table beforehand. We will come back to this point below.
•Holidays Sets are referred to by ID, not name.
The fact that this function looks for the next holiday in the holidays table is useful to iterate through all the holidays that may occur in the same Holidays Set on the same date.
For example if you had a Holidays Set with 2 holidays on the same date, then calling FindNextHolidayOnDate would return true a first time, true a second time, and then false afterwards. Each time it returns true, you know the table's cursor is set on a record matching the holiday you are looking for. You can then use the functions GetHolNameFromTable, GetHolIdFromTable and GetHolDateFromTable to obtain specific information about this holiday.
If you wish to make sure that you are searching for a holiday from the beginning, you can initialize the holidays table to Reset_FindNextHolidayOnDate.
// look for all holidays on same date
// do something
nDate = nDate + 1 // move on to next date
nHolSet refers to the ID of one of the Holidays Sets of the current Holidays List. You seldom see this ID, as you are more likely to refer to it by name, such as "Canadian Provincial Holidays". To obtain the ID of a given Holidays Set you have 2 options :
•Select the Holidays Set in the Holidays Manager; the name of the set and its ID will appear on the recurring holidays tab, at the top of the list of recurring holidays.
•Have your Macro iterate through all the Holidays Sets contained in a given Holidays List. This is the way this function is usually used and there is an example of it here.
The reason this macro function uses the ID rather than the name is not to torture you, but to make sure that your macro doesn't break if someone else changes the name of a Holidays Set. The name of a Holidays Set can be changed a million times, but its ID will remain the same (and unique).