Hello,
I am trying to put all
NOT hidden Bookmarks into an Array. But it want work, because of the 9s-fault, because
Code:
ActiveDocument.Bookmarks(MyRange.Bookmarks(x).Name).Range.Font.Hidden = False
want work.
I solved this issue by adding some Bookmarks_dummy into the faulty ranges with only view words in these. Now the code recognizes the Bookmarks and with repace() I delete the "_dummy". At the end I got my list. But its not the way as it should be. I would prefer a clean solution.
I use this code (here without my dummy-Replasement)
Code:
Sub useFormInhaltFuellen()
'nach Reihenfolge im Doku sortiert
'ohne Kopf- und Fußzeile
Dim aDoc As Word.Document
Dim nDoc As Word.Document
Dim x As Long, i As Long
Dim MyRange As Word.Range
Dim v As String
Set aDoc = ActiveDocument
If aDoc.Bookmarks.Count < 1 Then
MsgBox "kein Textmarken im Dokument enthalten!"
Exit Sub
End If
i = 0
ReDim strArray(aDoc.Bookmarks.Count, 0)
For Each MyRange In aDoc.StoryRanges
Do While Not MyRange Is Nothing
v = MyRange.StoryType
If MyRange.StoryType = wdMainTextStory Then
For x = 1 To MyRange.Bookmarks.Count
If ActiveDocument.Bookmarks(MyRange.Bookmarks(x).Name).Range.Font.Hidden = False Then
strArray(i, 0) = MyRange.Bookmarks(x).Name
i = i + 1
End If
Next x
End If
Set MyRange = MyRange.NextStoryRange
Loop
Next
'Listbox1 eintragen
ufInhalt.ListBox1.List = strArray
End Sub
Thank you for your help.
Kind regards