Option Explicit On
'----< Setup Parameters
>----
Const const_Path_Photos_Default As String = "B:\2020"
Const const_int_maxLength_Photos As String = 17
Const Nr_Table_with_Fotos As Integer = 1
Const Show_Filenames As Boolean = True
Const Show_ImageNr As Boolean = True
Const Add_Empty_Textline As Boolean = True
'----</ Setup Parameters
>----
'=====< BUTTONS
>=========
Private Sub btnMarkieren_Click()
Find_Placeholder()
End Sub
'=====</ BUTTONS
>=========
Private Sub Find_Placeholder()
'-----------------< Find_Placeholder()
>-----------------
'< init >
Dim sPlatzhalter As String
sPlatzhalter = "Platzhalter"
Dim lenPlaceholder As Integer
lenPlaceholder = Len(sPlatzhalter)
Dim doc As Document
Set doc = Application.ActiveDocument
Selection.MoveStart
'</ init >
'----< @Loop: Controls >----
'*loop all Phrases
'For Each var In doc.Words
Dim i As Long
For i = 1 To doc.Words.Count - 2
Dim var As Variant
Set var = doc.Words(i)
If var.Text = "[" Then
Dim varPlatzhalter As Variant
Set varPlatzhalter = doc.Words(i +
1)
If varPlatzhalter = sPlatzhalter Then
'--< Platzhalter gefunden >--
Dim
range_Platzhalter As Range
Set
range_Platzhalter = var.Paragraphs(1).Range 'satz
auswaehlen
range_Platzhalter.SetRange 1,
lenPlaceholder 'markieren
range_Platzhalter.Text = "ERSETZT" 'ersetzen
'--</ Platzhalter gefunden
>--
End If
End If
Next
'----</ @Loop: Controls >----
'-----------------</ Find_Placeholder()
>-----------------
End Sub
|