After upgrading from CS3 to CS6 the duplicate function is now causing runtime error "Type Mismatch". Error occurs on the last line of code.
All am I trying to achieve is to duplicate a rectangle containing an EPS from one document into another document. The method appears to work but assigning a pageitem value as a function fails.
Dim moInDesign As InDesign.Application
Dim oFromDocument As InDesign.Document
Dim oToDocument As InDesign.Document
Dim oFromRectangle As InDesign.Rectangle
Dim oToRectangle As InDesign.Rectangle
Set moInDesign = CreateObject("InDesign.Application.CS6")
Set oFromDocument = moInDesign.Documents.Add
Set oFromRectangle = oFromDocument.Rectangles.Add
oFromRectangle.GeometricBounds = Array(72, 72, 144, 144)
Set oToDocument = moInDesign.Documents.Add
Set oToRectangle = oFromRectangle.Duplicate(oToDocument.Pages.Item(1))
it fails on CS5 too, to cheat and make it work, comment out (or remove) the rectangle dimensions
'Dim oFromRectangle As InDesign.Rectangle
'Dim oToRectangle As InDesign.Rectangle