Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-14-2021, 02:33 PM
Guessed's Avatar
Guessed Guessed is offline Hide Text in a document. Windows 10 Hide Text in a document. Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,161
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default


OK, try this code which collapses the range to test whether the bookmarked range starts with hidden formatting.
Code:
Sub useFormInhaltFuellen()
  'nach Reihenfolge im Doku sortiert
  'ohne Kopf- und Fußzeile
  Dim aDoc As Word.Document, aBkmk As Bookmark, v As String
  Dim aRng As Range, strArray() As String
  
  Set aDoc = ActiveDocument
  If aDoc.Bookmarks.Count = 0 Then
    MsgBox "kein Textmarken im Dokument enthalten!"
    Exit Sub
  End If
  
  For Each aBkmk In aDoc.Bookmarks
    Set aRng = aBkmk.Range
    aRng.Collapse Direction:=wdCollapseStart
    If Not aRng.Font.Hidden Then
      v = v & "|" & aBkmk.Name
    End If
  Next aBkmk
  v = Mid(v, 2)                      'remove the leading separator
  strArray = Split(v, "|")
  ufInhalt.ListBox1.List = strArray  'Listbox1 eintragen
End Sub
I didn't work out why you looped through every storytype to only only work with the main body of the document so I left that out of my code.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply



Similar Threads
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
Hide Text in a document. How to manage (display/hide) parts of the text within a document via table of content 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
Hide Text in a document. Hide sentances in a word document michaelgott Word 1 04-19-2012 08:11 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:31 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft