Results 1 to 5 of 5

Thread: [RESOLVED] something wrong with Excel

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    193

    Resolved [RESOLVED] something wrong with Excel

    I have been using Excel in vb.net for years and no problem but I have a new app and nothing is working. First I can't get Microsoft.office.interop referenced anywhere, which was weird.

    Then I can't instantiate Excel App..
    Dim pExcel_App as New Excel.Application -- this gives me error "New cannot be used on an interface??

    But I can do this..
    Dim pExcel_App As New Excel._ExcelApplication -- where did this come from?

    Then I can't put anything into cells
    Dim wkbSheet As Excel.Worksheet
    wkbSheet.Cells(1,1) = "Title" --- this give me an error "Expression is a value and therefore cannot be the target of an assignment"

    THe really weird thing is that I have an old app open at the same time that is just fine with all this code. AND the intellisense is different for each cell.
    The good one sets is as a range, the bad one says it is an object???

    I re-installed the MS PIA's but this didn't help.
    I am totally stuck here??????

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: something wrong with Excel

    which version of the Microsoft Office Object Library are you referencing?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    193

    Re: something wrong with Excel

    good question. I checked the app that is working used 2.2, mine is using 2.4. I removed and add MS Office 10.0 but it is still 2.4?? I would think I should be using the newest, but what are the changes now to use the objects??


    I'm getting around some of the issues by using this statement

    Dim pExcel_App As new Excel_ExcelApplication

    but I cant put data into the cells, this won't work??

    Dim wkbSheet As _ExcelSheet --> OK
    wkbSheet.cells(1,1) = "test" --> doesn't work????


    thanks

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,424

    Re: something wrong with Excel

    sorry i meant the Microsoft Excel Object Library...

    i know the in 12.0 it's:

    Dim pExcel_App as New Excel.ApplicationClass

    but in 14.0 it's:

    Dim pExcel_App as New Excel.Application

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2003
    Posts
    193

    Talking Re: something wrong with Excel

    Nic fast response Paul. You got me thinking about versions, there are so many!!!??? I removed what I had and added the following and all is good now..

    1.Microsoft Office 11.0 Object Library
    2.Microsoft Excel 11.0 Object Library


    thanks for your help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width