private void adxRibbonButton1_OnClick(object sender, IRibbonControl control, bool pressed) { Excel.Range selectedRange = null; if (ExcelApp.Selection is Excel.Range) { selectedRange = ExcelApp.Selection as Excel.Range; } Form derpForm = new ParamMapForm(selectedRange); derpForm.ShowDialog(); }