日期:2014-05-18  浏览次数:20764 次

怎么用excel.application.workbooks.open读取EXCEL模板
VB.NET code

    '读取路径
    Public readPath As String

    Public app As Excel.Application

    Public wbs As Excel.Workbooks
    Public wb As Excel.Workbook
    Public wss As Excel.Worksheets
    Public ws As Excel.Worksheet

    ''' <summary>
    ''' 打开一个Excel文件
    ''' </summary>
    ''' <param name="FileName">文件名</param>
    ''' <remarks></remarks>
    Public Sub Open(ByVal FileName As String)
        Try
            app = New Excel.Application()
            wbs = app.Workbooks
            [color=#FF0000]wb = wbs.Open(readPath & FileName, Type.Missing, False, Type.Missing,Type.Missing, 
                _Type.Missing, Type.Missing, Excel.XlPlatform.xlWindows, Type.Missing, Type.Missing, 
                _Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing)[/color]
            Me.mFilename = FileName
        Catch ex As Exception

        End Try
    End Sub


读一个模板,在红色那一段,就会卡住,等N长时间也不往下走,也不出错,求教我这样写对吗?

------解决方案--------------------
http://blog.csdn.net/fangxinggood/article/details/655313