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
this also gives me problem.
Sub DuplicateSelection()Dim sr As Shape, nc As Integer, pnext As Page, sduplicate As Shape
For i = 1 To 1Set sr = ActiveSelectionSet pnext = ActiveDocument.InsertPages(1, False, ActivePage.Index)
Set sduplicate = sr.Duplicatesduplicate.MoveToLayer pnext.ActiveLayer
Next ipnext.Activate
I want to duplicate an active selection. the bold line is giving me problem
ActiveShape returns shape, ActiveSelectionRange returns some selected shapes as shaperange.
ok.
but increasing the quantity to 3 brings "type mismatch" error on the bold line
Sub DuplicateSelection()Dim sr As Shape, pnext As Page, sduplicate As Shape
For i = 1 To 3Set sr = ActiveShapeSet pnext = ActiveDocument.InsertPages(1, False, ActivePage.Index)
you again confuse shape and shaperange
Dim sr As ShapeRange, pnext As Page
Set sr = ActiveSelectionRange 'before loop
For i = 1 to 3
Set pnext = ActiveDocument.InsertPages(1, False, ActivePage.Index)
sr.Duplicate.MoveToLayer pnext.ActiveLayer
Next
ok. the problem is this line. I should have placed it before the loop. thanks
shark_ said:Set sr = ActiveSelectionRange 'before loop