VBScript Copy & Paste Section - InfoPath Dev
in

InfoPath Dev

VBScript Copy & Paste Section

Last post 10-29-2008 09:50 AM by Jimmy. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 05-15-2007 07:21 AM

    • edove
    • Top 500 Contributor
    • Joined on 08-21-2006
    • Posts 50

    VBScript Copy & Paste Section

    I am using the code below to copy a section in a repeating section, add a new section and paste into it so both sections are the same.

    I was using JS but I've converted to VBScript and it doesn't like the xCollection line. I get a message on that line saying "Cannot use parentheses when calling a Sub"

    objXMLNodes = XDocument.DOM.selectSingleNode("/my:myFields/my:lotBreakdown/my:lotBreakdownRT")
    XDocument.View.SelectNodes(objXMLNodes)
    XDocument.View.ExecuteAction("Copy")
    XDocument.View.ExecuteAction("XCollection::Insert", "lotBreakdownRT_41")
    XDocument.View.ExecuteAction("Paste")


    Any ideas how to do the insert in VBS?

  • 10-29-2008 09:50 AM In reply to

    Re: VBScript Copy & Paste Section

    This is an old post, but I ran into a similar issue myself today, and as the error suggests, the correct syntax is to not use parentheses:

    XDocument.View.ExecuteAction "XCollection::Insert", "lotBreakdownRT_41"

    alternatively, you can precede the statement with the Call keyword and use parentheses:

    Call XDocument.View.ExecuteAction("XCollection::Insert", "lotBreakdownRT_41")

    For more information, see:
    http://blogs.msdn.com/ericlippert/archive/2003/09/15/52996.aspx

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.