Results 1 to 4 of 4

Thread: XP compatability problem???

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    4

    XP compatability problem???

    Hi,

    Using VB6 with SP6 I have written some software that accesses an excel file. I have compiled and run it on two computers that are on Windows 2000 and it works fine, although they both do have VB6 installed so I don't know the relevance of that.

    The problem comes when I run it on XP (tried 2 seperate PCs) . I get an invalid page error come up at this point of the program...

    ##############################################
    Dim xlApp As Excel.Application
    Dim wb As Workbook
    Dim ws As Worksheet
    Dim var As Variant

    Set xlApp = New Excel.Application

    Set wb = xlApp.Workbooks.Open("c:\dump\" & txt_jn & ".xls")
    Set ws = wb.Worksheets("Sheet1")
    ##############################################

    Obviously the relevant folders and files are in place on the PC.

    I am referencing "C:\Program Files\Microsoft Office\Office10\excel.exe" but I note that on the pc with XP it is in fact C:\Program Files\Microsoft Office\Office\excel.exe.

    Is this the likely cause and if so what can I do to get around this?

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: XP compatability problem???

    Its not good to reference Excel (or office apps) when the versions could be different.

    Remove the reference, and change it to

    Dim xlApp as Object
    Set xlApp = CreateObject("Excel.Application")

    now, you need to go thru your code and find any Excel Constanst and replace them with the value... so like
    xlThick = 2
    xlAutomatic = -4142 (I think)

    stuff like that, since VB will no longer know what the values are..

    understand?
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: XP compatability problem???

    There is a longer version of Static's explanation (and a link to a module which contains all of the contsants) in my Excel Tutorial (link in my signature).

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: XP compatability problem???

    u built a module with all the constants!??.. sweet.

    [EDIT] ahh.. is see MS did it.. still, nice find[/EDIT]
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

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