Sub SelectionToNewPage()Dim sr As ShapeRangeSet sr = ActiveSelectionRangesr.CutActiveDocument.AddPages 1ActivePage.ActiveLayer.Paste
End Sub
Can someone add this...
after moving the selection... immediately launch to rename the page option
[CgsAddInMacro] public void MoveSelectionToNewPage() { ShapeRange sr = corelApp.ActiveSelectionRange; if (sr.Count == 0) return; Page page = corelApp.ActiveDocument.AddPages(1); Layer layer = page.ActiveLayer; sr.MoveToLayer(layer); DataSourceProxy proxy = corelApp.FrameWork.Application.DataContext.GetDataSource("WPageDataSource"); proxy.InvokeMethod("OnRenamePage"); }
Converted to VBA by ChatGPTSub MoveSelectionToNewPage() Dim sr As ShapeRange Set sr = ActiveSelectionRange If sr.Count = 0 Then Exit Sub End If Dim newPage As Page Set newPage = ActiveDocument.AddPages(1) Dim layer As Layer Set layer = newPage.ActiveLayer sr.MoveToLayer layer Dim proxy As DataSourceProxy Set proxy = Application.FrameWork.Application.DataContext.GetDataSource("WPageDataSource") proxy.InvokeMethod "OnRenamePage"End Sub
oho. how to add this to sub and end in between area. i do not know much about script
Sub MoveSelectionToNewPage()Dim sr As ShapeRangeSet sr = ActiveSelectionRangesr.Cut 'Move Selection'sr.Copy 'Copy SelectionActiveDocument.AddPages 1ActivePage.ActiveLayer.Pastemyname = InputBox("Page Name?", "RENAME PAGE")If Trim(myname <> "") ThenActivePage.Name = mynameEnd IfEnd Sub
Thanking you. Working