Good morning!

I'm trying to develop a sub routine where I need to copy the next word whenever appears "Modelo:", example:

Modelo: OPTIFLUX 2100 C
The text I need to copy is "OPTIFLUX 2100 C", there is a tab between "Modelo:" and "OPTIFLUX 2100 C".

The code I develop is:


Sub Chipita_kok(W, V, Y, Z, x, New1)
Dim Modelo1 As String
 
    New1 = ""
    Modelo1 = ""
   
    W = Selection.Information(wdActiveEndPageNumber)
    Z = Selection.Information(wdVerticalPositionRelativeToPage)
   
    On Error Resume Next
 
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "Modelo:"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = wdFindStop
        .Format = False
        .MatchCase = False
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    Selection.Find.Execute
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.MoveRight Unit:=wdWord, Count:=1
    Selection.EndKey Unit:=wdLine, Extend:=wdExtend
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    Selection.Copy
    Modelo1 = Selection
    V = Selection.Information(wdActiveEndPageNumber)
    If Left(Modelo1, 9) = "IFC 100 W" Or Left(Modelo1, 9) = "IFC 100 C" Or Left(Modelo1, 9) = "IFC 070 C" Or Left(Modelo1, 9) = "IFC 070 F" Or Left(Modelo1, 9) = "IFC 050 C" Or Left(Modelo1, 9) = "IFC 050 W" Or Left(Modelo1, 13) = "Optiflux 2000" Or Left(Modelo1, 5) = "V/Ref" Or Left(Modelo1, 13) = "Optiflux 1000" Then
    Modelo1 = ""
    If V = "" Then GoTo Fomes
    Selection.EndKey Unit:=wdLine
    x = Selection.Information(wdVerticalPositionRelativeToPage)
    Y = Selection.Information(wdVerticalPositionRelativeToPage)
 
    Else
    New1 = Modelo1
    End If
 
Fomes:
 
    Y = Selection.Information(wdVerticalPositionRelativeToPage)
    Selection.EndKey Unit:=wdLine
    'Selection.MoveDown Unit:=wdLine, Count:=5
 
End Sub
It becames more complex when I need to avoid some text just like "IFC 100 W", "IFC 100 C", "IFC 070 C", (...)

The state of the art for this routine is when appers a table just like:

Qde Diāmetro/Flanges
5 DN25 PN40
1 DN32 PN40
8 DN40 PN40
2 DN50 PN40
3 DN65 PN16
6 DN80 PN40
1 DN100 PN16



the variable Modelo1 must be is equal to "OPTIFLUX 2100 C" as many the "Qde" times, for this table 7 times. Note: the tables appears sometimes.

Is this possible in VBA?

Any help will be much appreciated!

Best regards

Nuno