'Create a defined name in the workbook.
Args:
name:    The defined name.
formula: The cell or range that the defined name refers to.
Returns:
Nothing.'

def define_name(self, name, formula):

    sheet_index = None
    sheetname = ''
    if formula.startswith('='):
        formula = formula.lstrip('=')
    sheet_parts = re.compile('^(.*)!(.*)$')
    match = sheet_parts.match(name)
    if match:
        sheetname = match.group(1)
        name = match.group(2)
        sheet_index = self._get_sheet_index(sheetname)
        if (sheet_index is None):
            warn(("Unknown    sheet    name    '%s'    in    defined_name()" % force_unicode(sheetname)))
            return (-1)
    else:
        sheet_index = (-1)
    if ((not re.match('^[\\w\\\\][\\w\\\\.]*$', name, re.UNICODE)) or re.match('^\\d', name)):
        warn(("Invalid    Excel    characters    in    defined_name():    '%s'" % force_unicode(name)))
        return (-1)
    if re.match('^[a-zA-Z][a-zA-Z]?[a-dA-D]?[0-9]+$', name):
        warn(("Name    looks    like    a    cell    name    in    defined_name():    '%s'" % force_unicode(name)))
        return (-1)
    if (re.match('^[rcRC]$', name) or re.match('^[rcRC]\\d+[rcRC]\\d+$', name)):
        warn(("Invalid    name    '%s'    like    a    RC    cell    ref    in    defined_name()" % force_unicode(name)))
        return (-1)
    self.defined_names.append([name, sheet_index, formula, False])
