none
vb2013怎样读取excel文件 RRS feed

  • 问题

  • Imports Microsoft.Office.Interop

    Public Class ProgressBar

    Dim xlApp As Excel.Application

    Dim xlWorkbook As Excel.Workbook

    Dim xlWorksheet As Excel.Worksheet

    Private Sub ProgressBar_Load(sender As Object,e As EventArgs) Handles Me.Load

    xlApp=New Excel.Application

    xlWorkbook=xlApp.Workbooks.Open("Book1.xlsx")

    xlWorksheet=xlWorkbook.Sheets("sheet1") '这个语句报错

    End Sub

    End Class

    Error Description: Option Strict On disallows implicit conversions from 'Object' to 'Microsoft.office.interop.Excel.Worksheet'

    vs版本:2013

    excel版本:2013

    添加的引用:Microsoft Excel 15.0 Object Library

    2013版本对excel的读取规则有新的修改,我在其他地方找了相关资料,貌似都不适用。这里的错误要怎么修改啊?

    2014年12月26日 1:02

答案

全部回复