How to focus or select a cell in Excel

后端 未结 3 2187
感动是毒
感动是毒 2021-01-17 10:58

How to focus a cell in Excel VSTO using C# or to select first cell using C# in VSTO?

3条回答
  •  不思量自难忘°
    2021-01-17 11:00

     Excel.Application ExcelApp = (Excel.Application)Marshal.GetActiveObject("Excel.Application");
                Excel.Workbook book = ExcelApp.ActiveWorkbook;
                Excel.Worksheet sheet = book.ActiveSheet;
                Excel.Range ExcelRange = sheet.get_Range("A1");
                ExcelRange.Select();
    

提交回复
热议问题