Can anyone help me find a solution to this task? A macro or native in Corel that can do this easily?I want to make a selection of objects, and move them to their own individual pages. Here's a video that hopefully explains it better.
Thanks!
Here's a quick-and-dirty to get things started:
Sub shapes_to_pages() Dim s As Shape Dim pThis As Page For Each s In ActiveSelectionRange Set pThis = ActiveDocument.AddPages(1) s.MoveToLayer pThis.Layers("Layer 1") s.CenterX = pThis.CenterX s.CenterY = pThis.CenterY Next s End Sub
That works great! I'm trying to fit the page to the content. I use your macro. Is there a way to run a macro within a macro? Or a shortcut? It's assigned to CTRL+SHIFT+F.
I figured it out!
Sub shapes_to_pages() Dim s As Shape Dim pThis As Page For Each s In ActiveSelectionRange Set pThis = ActiveDocument.AddPages(1) s.MoveToLayer pThis.Layers("Layer 1") s.CenterX = pThis.CenterX s.CenterY = pThis.CenterY pThis.SizeHeight = s.SizeHeight pThis.SizeWidth = s.SizeWidth Next s End Sub
Jamie Chestnut said:I figured it out!
Hey, that's great!
Now that you have the bones of it doing everything you want, here is how how I might wrap it up:
Sub shapes_to_pages() Dim s As Shape Dim pThis As Page Dim blnHaveCommandGroup As Boolean On Error GoTo ErrHandler If Not ActiveDocument Is Nothing Then If ActiveSelectionRange.Count > 0 Then EventsEnabled = False Optimization = True blnHaveCommandGroup = True ActiveDocument.BeginCommandGroup "shapes to pages" For Each s In ActiveSelectionRange Set pThis = ActiveDocument.AddPages(1) s.MoveToLayer pThis.Layers("Layer 1") s.CenterX = pThis.CenterX s.CenterY = pThis.CenterY pThis.SizeHeight = s.SizeHeight pThis.SizeWidth = s.SizeWidth Next s Else MsgBox "Nothing is selected." End If Else MsgBox "No document is active." End If ExitSub: If blnHaveCommandGroup Then ActiveDocument.EndCommandGroup Optimization = False EventsEnabled = True Refresh End If Exit Sub ErrHandler: MsgBox "Error occurred: " & Err.Description & vbCrLf & vbCrLf & "shapes_to_pages()" Resume ExitSub End Sub
That checks whether a document is active, and if something is selected. It adds some error handling, enables optimization, and disables events. It creates a commandgroup so that everything is wrapped up in a single entry in the Undo list.
Thank you! It works perfectly.