Hello to all,

I hope every one is starting their Friday off well .

I have come back to ask for help, on a range paragraph - table problem as well.


I have lots of paragraphs - they all start similarly::


---------------------------------------------

DNS345

Video provides a powerful way to help you prove your point. When you click Online Video,

End


DNS732

Video provides a powerful way to help you prove your point. When you click Online Video,
text text text text text text text text text text text text
End

---------------------------------------------


I need to move these into a table in a new document.

So I will end up with

Column 1 -ID | Column 2 - Text

DNS345 | Video provides a powerful way to help you prove your point.When you click Online Video, End


I am very sad I hoped the macro recorder would help me solve this, but there is not much hope of that, its a good as a useless teapot.


I tried to code a basic version - alas it's not very attractive be warned
Sub CopyParagraphTable

Dim oRng As Range, aTable As Range
  
    Dim StringPara As String
    Set rng = ActiveDocument.Content
    With rng.Find

        .ClearFormatting
        .MatchWildcards = True
        .Wrap = wdFindStop

        .Text = "[A-Z0-9]{1,}"

        Do While .Execute

            StringPara = StringPara & vbCr & rng.Text        '  END  here
        Loop
    End With

' Move  strings range now into table

With aTable.Tables(1)

  Set aTable = oRng.Paragraphs(1).Range
  'Put this into first column 

   Number(aTable.Cell(1, 1).Range.Words(1).Text) Then
                Set oRng = oTable.Range
                Do While 
  
     (aTable.Cell(1, 2).Range.StringPara(2).Text)

                    aTable.End = aTable.Next.End
                Loop
                oRng.End = aTable.End

'and now stuck

' Need to add document source  and copy to table

So to Recap

All the text starts with DNS and ends with - END

DNS goes into Column 1 - Content in Column 2 For each range.


I would be so grateful for the kindness of the code philanthropists to help solve this problem. As I don't know what to do, the most advanced help I received from the VBE editor was a ground breaking Selection.Copy and nothing else.

thank you so much for your time, expertise and helping me

I am very grateful

Saphire