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
Is error appears on this line - sduplicate.MoveToLayer pnext.Layers(s.Layer.Name) ?
btw, ShapeRange have methods .Duplicate and .MoveToLayer, no need to do a For-Each loop
this line is the problem
Set pnext = ActiveDocument.InsertPages(1, False, ActiveDocument.Pages(1))
especially the bolded one
3rd parameter in InsertPages must be Long type. And ActiveDocument.Pages(1) returns Page.
Try this:
Set pnext = ActiveDocument.InsertPages(1, False, ActiveDocument.Pages(1).Index)
great!