Can't pass variable to NewFromSolutionWithData? - InfoPath Dev
in

InfoPath Dev

Can't pass variable to NewFromSolutionWithData?

Last post 10-23-2007 03:19 AM by Helen.Trim. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 10-23-2006 02:47 PM

    Can't pass variable to NewFromSolutionWithData?

    Hi, I have the following code that I am using to create a new Form with data from xmlPath using the template in templatePath. When I execute the code as it is below, I get an error: Script error, the parameter is incorrect".

    Sub generateTestResults_OnClick(eventObj)

    xmlPath = "C:\temp\CRS_51606_page_check_output.xml"
    templatePath = "C:\temp\pdfTestResults.xsn"

    set objXDoc = Application.XDocuments.NewFromSolutionWithData(xmlPath,templatePath)

    End Sub

    However, when I put the strings into the NewFromSolutionWithData method like so:

    set objXDoc = Application.XDocuments.NewFromSolutionWithData("C:\temp\CRS_51606_page_check_output.xml","C:\temp\pdfTestResults.xsn")

    it works fine! I need to be able to build these strings dynamically at runtime, so using the variables is important. Can someone help?

    Thanks,

    Paul
  • 10-23-2006 10:45 PM In reply to

    Re: Can't pass variable to NewFromSolutionWithData?

    Hello Paul,
    Welcome to the Forum!
    Try this, it should work for you.
    xmlPath = "C:\\temp\\CRS_51606_page_check_output.xml";
    templatePath = "C:\\temp\\pdfTestResults.xsn";
    objXDoc = Application.XDocuments.NewFromSolutionWithData(xmlPath,templatePath);

    Basically you are not setting escaping the "\" in the string.
  • 10-24-2006 11:13 AM In reply to

    Re: Can't pass variable to NewFromSolutionWithData?

    Thanks for the reply! Actually, I had thought of that, but even with the \'s escaped I get the same error.
  • 10-23-2007 03:19 AM In reply to

    • Helen.Trim
    • Not Ranked
      Female
    • Joined on 10-23-2007
    • Hampshire, England
    • Posts 3

    Re: Can't pass variable to NewFromSolutionWithData?

    Hello Paul

    Did you ever find a solution to this problem? 

    I am having the same thing happen to me.  It works with the parameters as strings, but not as variables.

    Can you help?

    Thanks,

    Helen

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