Beispiel #1
0
        /// <summary>
        /// Depending on the workbookname we will activat the addin.
        /// </summary>
        /// <param name="Wb"></param>
        private void Application_WorkbookActivate(Excel.Workbook Wb)
        {
            RibbonKlip KlipRibbon = (RibbonKlip)Globals.Ribbons.GetRibbon(typeof(RibbonKlip));

            Excel.Worksheet ws = Application.ActiveSheet;
            //Is there a pattern for this sheet?
            string pattern = GetPattern(Wb.NameWithoutExtension());

            if (!string.IsNullOrEmpty(pattern) && ws != null && Regex.IsMatch(ws.Name, pattern))
            {
                KlipRibbon.EnableGeneration = true;
            }
            else
            {
                KlipRibbon.EnableGeneration = false;
            }
        }