Results 1 to 4 of 4

Thread: OLE Automating Portability problems

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Location
    UK
    Posts
    2

    Question OLE Automating Portability problems

    Hello all,

    I wondwer if you can help me, I have some code that works in VBA and vb on my windows xp, office 2000 box, however on my windows 98, office 97 box, it works in VBA (Excel), but not in VB,
    Can anyone solve this little one for me?

    Heres the code...

    Dim xlApp As Excel.Application
    Dim xlBook As Excel.Workbook
    Dim xlSheet As Excel.Worksheet
    Dim data As Variant
    'On Error GoTo errorhandler

    'Set xlApp = New Excel.Application
    Set xlApp = Excel.Application
    Set xlBook = Excel.Workbooks.Add
    Set xlSheet = Excel.Worksheets.Add
    xlSheet.Name = "results"
    xlApp.Visible = True
    xlSheet.Activate

    'If this line works i'll through a party
    xlSheet.Cells(1, 1).Value = "hello"


    'xlBook.Close False
    'xlApp.Quit
    Set xlApp = Nothing
    Set xlBook = Nothing
    Set xlSheet = Nothing
    End
    errorhandler:
    MsgBox Err.Description
    End

    As i say this works great on my windows xp system, but not on my windows 98 system, neither anyof the other 98 system i have tried.

    Each time i am referencing the Excel9.olb in the vb program but this does not seem to change anything.

    The line it points to is the line with .cell(1,1).
    Error message -2147417848 which means "The object invoked has disconnected from its clients".

    Thanks in advance

  2. #2

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Location
    UK
    Posts
    2
    I have managed to resolve this matter.

    When i packaged the files ready for disturbution i found that the installer iwas using made a default reference to the excel9.olb to be installed on the host machine.

    You must disable it such that the file is not distrubuted and this for some reason seems to correct the problem.

    -out-

  3. #3
    Frenzied Member TheBionicOrange's Avatar
    Join Date
    Apr 2001
    Location
    Cardiff, UK
    Posts
    1,818
    Thats because VB uses different reference libraries for Excel 97 and Excel 2000.

    Excel 200 uses version 9.0 and I think Excel 97 uses version 5.0.


  4. #4
    New Member
    Join Date
    Feb 2002
    Location
    Chesterfield,England
    Posts
    3

    excel olb

    i think that you will find Excel 97 uses excel8.olb not 5 as mentioned previously

    certainly excel9 from Excel2000/2002 will not work with earlier versions of excel

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