![]() |
#9
|
|||
|
|||
![]()
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 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 Kind regards |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to text heading1 text heading1 text? How to collapse or hide text in the middle of a line. | TImer | Word | 7 | 08-10-2020 12:52 AM |
Conditionally hide parts of a document | elaineAda | Word VBA | 0 | 04-01-2019 10:00 PM |
![]() |
Curby | Word | 2 | 06-30-2016 12:29 AM |
Page nos in footers - how to hide mid document | willynilly | Word | 2 | 11-22-2013 07:21 AM |
![]() |
michaelgott | Word | 1 | 04-19-2012 08:11 PM |