ActiveLayer.Paste.addToSelection gives run-time error 91

Hello.

I have this routine which pastes the object in active layer and aligns it to center of page:

Sub PasteAndAlignToPageCenter()

'paste and select
ActiveLayer.Paste.AddToSelection 'this line gives run-time error 91


'align to page center
ActiveSelectionRange.AlignAndDistribute cdrAlignDistributeHAlignCenter, cdrAlignDistributeVAlignCenter, cdrAlignShapesToCenterOfPage
End Sub

Please help.

Thanks and regards.

Parents
No Data
Reply
  • Dim s As Shape

    Set s = ActiveLayer.Paste

    If Not s Is Nothing Then s.AlignAndDistribute cdrAlignDistributeHAlignCenter, cdrAlignDistributeVAlignCenter, cdrAlignShapesToCenterOfPage

Children
No Data