i want to do indexing in my designs but sometime design has 10 pages sometime 100 and sometime its 500
i will wrote indexing according to the pages for example i have 10 pages book and now i have wrote all the index example are below
abc
def
ghi
jkl
mno
pqr
stu
wvx
yz1
234
now i will create a box of 15mm X10mm height box with a cut mark of 2 mm in bottom right of the box and
add all text to box according to the box for example 1st index in top 1st box, 2nd index in 2nd box etc.
now i group all box with index.
now i have 10 box with index grouped.
now i move them to the bottom right side according to the series
last step i paste 1 by 1 on different pages. 1st index on 1st page, 2nd on 2nd page and soo on
just like this i want macro
paraggoyal said:you can make it in a less step too let me ready the objects manually and move on the exact position where i actually want now i have suppose 20 objects or 50 objects/index from top to bottom in a series now move all the objects to different different pages from top to bottom respectively to different pages example just paste the 1st box from top to the same page where the index already we can seen no movement for the 1st top box 2nd box has to move from top on 2nd next page from the current page on exact same position 3rd box from top on 3rd next page from the current page on exact same position and so on it can also help me (please note i want to move on the next page from the current page for example i am on 42 page no. i want my object to work 1st object on 42 page then 2object on 43 page and so on)
At the moment, I am not using a computer with X5 on it, but this works for me in X7:
Sub move_sel_to_pages_top_to_bottom()Dim sr As ShapeRangeDim shape_index As LongDim start_page_index As Long Optimization = True ActiveDocument.BeginCommandGroup "selected to pages top-to-bottom" EventsEnabled = False On Error GoTo ErrHandler Set sr = ActiveSelectionRange sr.Sort "@shape1.Top > @shape2.Top" start_page_index = ActiveDocument.ActivePage.Index If sr.Count = 0 Then MsgBox "Nothing is selected.", vbInformation GoTo ExitSub Else If sr.Count = 1 Then MsgBox "Only one item is selected; nothing to move.", vbInformation GoTo ExitSub End If End If If ActiveDocument.Pages.Count - start_page_index + 1 < sr.Count Then MsgBox "Not enough pages are available for the selected items.", vbInformation GoTo ExitSub End If For shape_index = 2 To sr.Count sr(shape_index).MoveToLayer ActiveDocument.Pages(start_page_index + shape_index - 1).ActiveLayer Next shape_index ActiveSelectionRange.RemoveFromSelection Application.RefreshExitSub: Optimization = False EventsEnabled = True Application.Refresh ActiveDocument.EndCommandGroup Exit SubErrHandler: MsgBox "Error occurred: " & Err.Description Resume ExitSub End Sub
paraggoyal said:eskimo is there any way just like this we can move our first top text to first box, second text to to second box etc. text would be in 1 paragraph. ?
I don't know if I understand what you are asking for here.
When I do this, each box + text is a group:
just like this
paraggoyal said: just like this
Sub text_paras_to_rectangles()Dim sr1 As ShapeRangeDim sr2 As ShapeRangeDim para_count As LongDim counter_1 As LongDim s2 As ShapeDim tr As TextRange Optimization = True ActiveDocument.BeginCommandGroup "text paras to rectangles" EventsEnabled = False On Error GoTo ErrHandler Set sr1 = ActiveSelection.Shapes.FindShapes(, cdrRectangleShape) If sr1.Count = 0 Then MsgBox "No rectangles were found in the selection." GoTo ExitSub End If Set sr2 = ActiveSelection.Shapes.FindShapes(, cdrTextShape) If sr2.Count = 0 Then MsgBox "No text shape was found in the selection." GoTo ExitSub Else If sr2.Count > 1 Then MsgBox "More than one text shape was found in the selection." GoTo ExitSub End If End If para_count = sr2(1).Text.Story.Paragraphs.Count If para_count <> sr1.Count Then MsgBox "Number of paragraphs (" & para_count & ") in the selection does not match the number of rectangles (" & sr1.Count & ") in the selection." GoTo ExitSub End If sr1.Sort "@shape1.top>@shape2.top" For counter_1 = 1 To para_count Set tr = sr2(1).Text.Story.Paragraphs(counter_1) Set s2 = ActiveDocument.ActiveLayer.CreateArtisticText(0, 0, tr.Text, , , tr.Font, tr.Size, tr.Bold, tr.Italic, tr.Underline) s2.Fill = tr.Fill s2.CenterX = sr1(counter_1).CenterX s2.CenterY = sr1(counter_1).CenterY Next counter_1 ActiveSelection.Shapes.All.RemoveFromSelectionExitSub: Optimization = False EventsEnabled = True Application.Refresh ActiveDocument.EndCommandGroup Exit SubErrHandler: MsgBox "Error occurred: " & Err.Description Resume ExitSubEnd Sub
Select the paragraph text shape and all of the boxes, then run the macro.