Skip to main content
Fightergator
Inspiring
December 3, 2022
Question

No Insertion Point or Active Document

  • December 3, 2022
  • 1 reply
  • 308 views

My find/change script steps through each document in a book as it executes.  At the start of the script, I read each doc filename in the book into an array and then use the SimpleOpen method to make each document active; something I picked from a post a few months ago.  However, I sometimes get an error that says, "No insertion point or active document.  Cannot continue."  Any thoughts on what I might do to fix this?  I searched the forum, but no luck.  Here's the code I'm using to open/activate each doc.

// Open each doc using doc.Name and call executeHitlist function
function searchDocs () {
    for (k = 1; k <= docCount; k++) {
        doc = SimpleOpen(openDocs[k]);
        $.writeln("Searching " + doc.Name + "...");
        doc = app.ActiveDoc;  
        executeHitlist ();
    }
}

 

    This topic has been closed for replies.

    1 reply

    Participating Frequently
    July 25, 2023

    Hi, Fightergator
    JavaScript arrays are zero-indexed: the first element of an array is at index 0.

    function searchDocs () {
        for (k = 0; k < openDocs.length; k++) {
            doc = SimpleOpen(openDocs[k]);
            $.writeln("Searching " + doc.Name + "...");
            doc = app.ActiveDoc;  
            executeHitlist ();
        }
    }