vsto winform窗体嵌入excel 获取wb为null解决

嵌入的excel无法获取激活的wb
var wb= sheet.Application.ActiveWorkbook;
wb=null;

解决办法:
  var sheet = cell.Worksheet;
  Excel.Workbook workbook = sheet.Parent;
   workbook.Activate();

你可能感兴趣的:(vsto,vsto)