11

I want to create a Form in Microsoft Word which is quite dynamic and enables the user to add multiple regions. The relevant data contains date-specific events which are sorted descendant. If you insert a new event, it has to appear on top of the list of regions.

As far as I know, you can only insert new regions under the last region. Is there a possibility to change this OR do I have to implement a snippet with Word-Macros to enable it?

EDIT (Curriculum Vitae - Example):

  • Primary School - 19xx - 19xx (I would call this line a 'region')
  • College - 19xx - 19xx
  • '__' - Date1 - Date2 (+)

So this is sorted in ascending order. WRONG! If i press the +-Button a new region is inserted underneath. I want to achieve something like this:

  • '__' - Date1 - Date2 (+)
  • College - 19xx - 19xx
  • Primary School - 19xx - 19xx

A new region is inserted above automatically.

Simon K.
  • 348
  • 1
  • 7
  • 24

3 Answers3

0

Are you in need to inserting a text in a word document in MS Word, something like this,

https://support.microsoft.com/en-us/kb/212682?wa=wsignin1.0

Joy Rex
  • 608
  • 7
  • 32
0

To insert a new region above an old one, it's as simple as clicking right on an existing region and "Insert element above".

https://msdn.microsoft.com/EN-US/library/office/jj889465.aspx

Olle Sjögren
  • 5,315
  • 3
  • 31
  • 51
Simon K.
  • 348
  • 1
  • 7
  • 24
0

VBA method using bookmarks:

  1. Define a bookmark where you want to add the new texts, e.g. after a header but before the other regions.

  2. Add a VBA code module and enter the following macro:

    Option Explicit
    
    Sub AddNewLine(psText As String)
        '***** Go to bookmark
        Selection.GoTo What:=wdGoToBookmark, Name:="[NAMEOFBOOKMARK]"
        '***** Place cursor at end of bookmark
        Selection.Collapse Direction:=WdCollapseDirection.wdCollapseEnd
        '***** Add new line
        Selection.TypeParagraph
        '***** Add text or whatever
        Selection.TypeText psText
    End Sub
    
  3. Replace the line Selection.TypeText psText with whaterver it is that you want to add - my example just enters the text-string from the sub parameter.

Olle Sjögren
  • 5,315
  • 3
  • 31
  • 51
  • I am completely happy with my solution. But does your suggestion only work with plain text or is it possible to "copy" content controls, too? This is what I was needing. – Simon K. Jun 18 '15 at 14:08
  • My suggestion as it stands only works for adding text. It should be possible to copy ContentControls also, but I haven't tried it. At least they are accessible through the word object model, as in `ThisDocument.ContentControls.Item(1).Copy`. – Olle Sjögren Jun 18 '15 at 15:54