Excel & Vb.Net


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Excel & Vb.Net

Hybrid View

  1. #1
    Depechie Guest

    Excel & Vb.Net

    Hello people,

    I'm trying to get excel working in my .Net application ( working with vb.net
    code ).
    Here is the code :

    Dim excelApp As Excel.Application
    Dim excelWorkbook As Excel.Workbook

    excelApp = New Excel.Application()
    excelWorkbook = excelApp.Workbooks.Open(strLocalPath)

    To create the application is no problem, but when the program opens the
    workbook I always get the same error :

    "old format or invalid type library"

    I just referenced to Excel 10.0 object library to get the Interopt.Excel.dll

    Any suggestions ?



  2. #2
    NNN Guest

    Re: Excel & Vb.Net


    You have to use Ctype function,
    Ex.
    Dim xlApp As Excel.Application

    xlApp = CType(CreateObject("Excel.Application"), Excel.Application)

    "Depechie" <ModDep@Hotmail.com> wrote:
    >Hello people,
    >
    >I'm trying to get excel working in my .Net application ( working with vb.net
    >code ).
    >Here is the code :
    >
    >Dim excelApp As Excel.Application
    >Dim excelWorkbook As Excel.Workbook
    >
    >excelApp = New Excel.Application()
    >excelWorkbook = excelApp.Workbooks.Open(strLocalPath)
    >
    >To create the application is no problem, but when the program opens the
    >workbook I always get the same error :
    >
    >"old format or invalid type library"
    >
    >I just referenced to Excel 10.0 object library to get the Interopt.Excel.dll
    >
    >Any suggestions ?
    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center