CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2002
    Posts
    56

    Win XP prof. with office 97.... trouble???

    Hi all,
    I have developed this application in VB .NET, for some reason keeping Excel as the backend. My developer PC is P-III 1 GHz with Win 2K server and the clients PCs are IBM P-IV (with Win XP Prof.). We have MS office 97 and they have Office 2000.
    Now the application is running fine on my system and the other P-II systems that we have in our off. But the same application is giving problems with MS Office 97 on Win XP prof. It gives the following error. "The server threw an exception." Pl. invoke JIT debugging. But no error comes when I run it on my machine.
    Need help urgently.

    Thanks.
    rajtofar

    REAL USERS HATE REAL PROGRAMMERS.
    rajtofar

  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878
    When you created the Excel object did you use early or late binding. If you used early binding and set reference to Excel and user have different Office version - it will cause the problem. If you want to do your application independent of excel version then use late binding
    Iouri Boutchkine
    iouri@hotsheet.NOSPAM.com

  3. #3
    Join Date
    Apr 2002
    Posts
    56
    hi iouri,
    Thanks for replying. I'll give you an idea of how I am referencing the excel object in my code......

    Public xlsheet As Excel.Application ' this goes in my Module.
    Public xlbook As Excel.Workbook ' this goes in my Module.

    then, in my form I call this function.... "openExcel()"

    Public Function openExcel() As Object
    xlsheet = New Excel.Application()
    'Set xlbook = New Excel.Workbook
    With xlsheet.Application.FileSearch
    .NewSearch()
    .LookIn = Environment.CurrentDirectory & "\Database\"
    .SearchSubFolders = True
    .FileName = "Manufacturing Companies Database.xls"
    .MatchTextExactly = True
    .FileType = 2
    End With
    End Function

    And at the end, i use this line to open the workbook.......

    xlbook = Mod1.xlsheet.Workbooks.Open(Environment.CurrentDirectory & "\Database\" & Mod1.xlsheet.FileSearch.FileName


    Please give me an idea as to what kind of changes should i make.

    rajtofar

    REAL USERS HATE REAL PROGRAMMERS
    [COLOR=red]
    rajtofar

  4. #4
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878
    YOu are using early binding. Change code for

    oExcel = CreateObject("Excel.Application")
    Dim wbk As Object

    wbk = oExcel.Workbooks.Open(Filename:="C:\temp\test.xls", UpdateLinks:=False, ReadOnly:=False)


    in this case you don't need reference Excel library and it will work for any version of Excel
    Iouri Boutchkine
    iouri@hotsheet.NOSPAM.com

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

Featured