0 Replies Latest reply on Jun 13, 2008 11:22 AM by (steven_wargo)

    Adding sections to a document.

      Hi-

      I'm trying to add sections to a document. Basically, I'm adding a new page, adding a section, adding a page,...

      but when I add the third page, I get the following error: (code generating this error follows the error)

      Any thoughts?

      Thanks!

      ============================================================
      ?ex
      {System.Runtime.InteropServices.COMException}
      System.Runtime.InteropServices.COMException: {"Error HRESULT E_FAIL has been returned from a call to a COM component."}
      Data: {System.Collections.ListDictionaryInternal}
      HelpLink: Nothing
      InnerException: Nothing
      Message: "Error HRESULT E_FAIL has been returned from a call to a COM component."
      Source: "mscorlib"
      StackTrace: " at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
      at InDesign.Sections.Add(Object Reference)
      at Mrll.Typeset.InDesignProxy.IndesignContext.AddPage() in ...

      ?iddocument.Sections.Count
      2
      ?iddocument.Pages.Count
      3

      ============================================================

      and here's my vb code:

      Me.IdPage = Me.IdDocument.Pages.Add(ID.idLocationOptions.idAtEnd)
      Try
      Me.IdDocument.Sections.Add(Me.IdDocument.Pages.LastItem)
      Catch ex As Exception
      Stop
      End Try