0 Replies Latest reply on Jul 14, 2011 9:25 AM by xmlapi

    New documents, how to keep track?

    xmlapi Level 1

      Our script is creating new documents and closing old documents. When you data merge, it creates a new document as well.


      In my script, I have this:

                          courseTemplate = app.Documents.LastItem();

          courseTemplate.TextPreferences.DeleteEmptyPages = true;


      Sometimes (rarely), this will throw an error saying the object was disconnected (c#). What this means is that the original coursetemplate (not the datamerged new document) was actually in the last item position. So when I called courseTemplate.Close and the next line tried to get the last item...it got the closed document. I'm not sure why the data merged new document isn't in last place in the queue since it was the last opened document.


      I could do this by name but I don't know the name of the new data merged document? is there a better way to do this?