I wanted to duplicate my active page in quantity to the first page. I used the code but it brings error "Object does not support this property or method"
Sub DuplicateToFirstPage()Dim sr As ShapeRange, nc As Integer, pnext As Page, sduplicate As Shapenc = InputBox("enter required")For i = 1 To ncSet sr = ActivePage.Shapes.AllSet pnext = ActiveDocument.InsertPages(1, False, ActiveDocument.Pages(1))For Each s In sr.ReverseRangeSet sduplicate = s.Duplicatesduplicate.MoveToLayer pnext.Layers(s.Layer.Name)Next sNext ipnext.Activate
End Sub
I tried to duplicate from a particular page (p) to another page (k) but gives me error (type mismatch) in the bold line
Sub DuplicatePage()Dim sr As ShapeRange, nc As Integer, pnext As Page, sduplicate As Shapenc = InputBox("enter required no.")p = InputBox("enter page from")k = InputBox("enter page to")For i = 1 To ncSet sr = ActiveDocument.Pages(p).Shapes.AllSet pnext = ActiveDocument.InsertPages(1, False, ActiveDocument.Pages(k).Index)For Each s In sr.ReverseRangeSet sduplicate = sr.Duplicatesduplicate.MoveToLayer pnext.Layers(s.Layer.Name)Next sNext ipnext.Activate
sduplicate is shape, sr.Duplicate returns shaperange
yea, you're right. Thanks