Help! XDocuments.Open failure - InfoPath Dev
in

InfoPath Dev

Help! XDocuments.Open failure

Last post 07-22-2009 12:42 PM by Hilary Stoupa. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 03-16-2006 09:34 AM

    • pfazza
    • Not Ranked
    • Joined on 03-16-2006
    • Posts 4

    Help! XDocuments.Open failure


    'this code works fine

    Set InfoPathApp = CreateObject("InfoPath.Application")
    Set myIFDoc = InfoPathApp.XDocuments.Open("c:\infopathtest.xml",1)
    myIFDoc.PrintOut


    'but this
    sPath = "c:\infopathtest.xml"
    Set InfoPathApp = CreateObject("InfoPath.Application")
    Set myIFDoc = InfoPathApp.XDocuments.Open("c:\infopathtest.xml",1)
    myIFDoc.PrintOut

    fails with the Runtime Error:
    'Infopath has enountered an Error. The operation failed. ?? Infopath cannot open the selected form. The parameter is incorrect.

    Why?

    As you can see, the only difference in the code fragments is that i am assigning the filepath to a string. I;ve tested this on two machines with two different configurations and also tested the corresponding action with Word Automation to check I wasn't doing something dopey.

    Any ideas, guys? It really does seem like a lurgey in the API


  • 03-16-2006 11:45 PM In reply to

    • pfazza
    • Not Ranked
    • Joined on 03-16-2006
    • Posts 4

    Re: Help! XDocuments.Open failure

    My error:

    INCORRECT CODE FRAGMENT SHOULD READ

    sPath = "c:\infopathtest.xml"
    Set InfoPathApp = CreateObject("InfoPath.Application")
    Set myIFDoc = InfoPathApp.XDocuments.Open(sPath,1)
    myIFDoc.PrintOut
  • 03-17-2006 10:50 PM In reply to

    Re: Help! XDocuments.Open failure

    Hi Pfazza and welcome to our life!

    Please try:
    sPath = "c:\\infopathtest.xml"
    Patrick Halstead
    Project Manager at Qdabra
  • 07-17-2009 02:09 AM In reply to

    • MarcS
    • Not Ranked
    • Joined on 07-17-2009
    • Posts 3

    Re: Help! XDocuments.Open failure

     Feels odd to revive this thread, but I'm having the same problem as described and haven't come up nor find a solution.

     

    So I'm hoping that there is a solution around 

  • 07-17-2009 08:03 AM In reply to

    Re: Help! XDocuments.Open failure

    Why don't you post your code so we can see what might be going wrong for you?

    Hilary Stoupa

  • 07-20-2009 01:28 AM In reply to

    • MarcS
    • Not Ranked
    • Joined on 07-17-2009
    • Posts 3

    Re: Help! XDocuments.Open failure

     Basically the same code as the original poster:

    sPath="C:\\base.xml"
    Dim ipApp
    Set ipApp = CreateObject("InfoPath.Application")
    Call ipApp.XDocuments.Open(sPath,8)

    ... some more code ...

     

     But, if I replace the Open-call like this:

     Call ipApp.XDocuments.Open("c:\\base.xml",8)

    then the script works fine.

     

     

  • 07-21-2009 08:35 AM In reply to

    Re: Help! XDocuments.Open failure

    I just verified that I get the same behavior. That's flat weird. However, since I'm stubborn, I tried this:

    sPath="C:\base"
    Dim ipApp
    Set ipApp = CreateObject("InfoPath.Application")
    Call ipApp.XDocuments.Open(sPath + ".xml",8)

    And it worked....

    Hilary Stoupa

  • 07-21-2009 11:41 PM In reply to

    • MarcS
    • Not Ranked
    • Joined on 07-17-2009
    • Posts 3

    Re: Help! XDocuments.Open failure

     I like your attitude :-)

     

     As sPath is filled in from arguments, I tried this

    Call ipApp.XDocuments.Open( sPath + "" ,  8 )

    And that works too!

     

    Thanks for being stubborn Hilary!

    Greetings,

    Marc

  • 07-22-2009 12:42 PM In reply to

    Re: Help! XDocuments.Open failure

    Ooooh, good thinking, Marc! just add a bit of nothing to the end of the string. How'd I'd love to know why the right way doesn't work tho!

    Hilary Stoupa

Page 1 of 1 (9 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.