【问题标题】:Excel worksheets error: One or more types required to compile a dynamic expression cannot be foundExcel 工作表错误:找不到编译动态表达式所需的一种或多种类型
【发布时间】:2017-02-22 10:04:35
【问题描述】:

我正在尝试获取 Excel 工作表单元格值以用作测试脚本中的输入。

我一直在关注http://www.telerik.com/forums/how-to-pass-excel-worksheet-name-path-as-string

        string myPath = @"C:\Users\Monica\Desktop\ExcelTest.xlsx";
        Excel.Application excelApp = new Excel.Application();
        Excel.Workbook workbook = excelApp.Workbooks.Open(myPath);

        //select the correct worksheet

        Excel.Worksheet demoWorksheet = (Excel.Worksheet)excelApp.Worksheets["Sheet1"];

我正在尝试从工作簿“ExcelTest.xlsx”中选择工作表“Sheet1”并收到以下错误

“找不到编译动态表达式所需的一种或多种类型”。

【问题讨论】:

  • 莫妮卡,感谢您使用所有正确的搜索词提出这个问题。在我想只搜索有用的错误消息之前,我已经研究了几个小时,查看语法等。

标签: c# visual-studio-2010 visual-studio-2012 telerik


【解决方案1】:

尝试删除“Microsoft.CSharp”引用,然后将其添加回您的项目。

【讨论】:

  • 或者,第一次添加就行了。呸! (对 MS 和 VS)。谢谢你(帕特里克)
  • 在我的情况下它已被删除。然后我只是添加了它。谢谢!!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-05-23
  • 2014-08-25
  • 2012-07-28
  • 2010-09-28
  • 1970-01-01
相关资源
最近更新 更多