View Single Post
 
Old 12-25-2015, 07:29 AM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,601
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Replace Person 1 with Person {Seq TblNum}
Note that is a sequence field and the braces are created using Ctrl+F9

Bookmark the entire Person # paragraph and table.

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Range
Dim oTbl As Table
Dim lngIndex As Long
  Set oRng = ActiveDocument.Bookmarks("PersonTable").Range
  oRng.Copy
  oRng.Collapse wdCollapseEnd
  oRng.InsertBefore vbCr
  oRng.MoveStart wdParagraph, 1
  For lngIndex = 1 To ActiveDocument.FormFields("Tekst1").Result - 1
    oRng.Paste
    oRng.Collapse wdCollapseEnd
    oRng.InsertBefore vbCr
    oRng.MoveStart wdParagraph, 1
  Next
  ActiveDocument.Fields.Update
lbl_Exit:
  Exit Sub
End Sub
Attached Files
File Type: dotm QuestionForum.dotm (25.9 KB, 18 views)
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote