Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-31-2014, 06:26 AM
XmisterIS XmisterIS is offline How to parse bold sections of a paragraph? Windows 7 64bit How to parse bold sections of a paragraph? Office 2007
Novice
How to parse bold sections of a paragraph?
 
Join Date: Sep 2013
Posts: 12
XmisterIS is on a distinguished road
Default How to parse bold sections of a paragraph?

I am writing a piece of code which parses the paragraphs of a document and uploads relevant bits to a server.

Consider a document in which three paragraphs exist, with Normal style.

The first para contains no additional formatting.
The second para is entirely bolded.


One word only within the third para is bolded.

Now, consider the following macro:

Code:
Public Sub paratest()
    Dim i As Integer
    
    For i = 1 To ActiveDocument.Paragraphs.Count
        With ActiveDocument.Paragraphs.Item(i)
            Debug.Print .Range.Text
            Debug.Print "Bold: ".Range.Bold
        End With
    Next
End Sub
This gives an output like:

Quote:
This is the first paragraph
Bold: 0

This is the second paragraph
Bold: -1

This is the third paragraph
Bold: 9999999
In fact, in the 3rd para, the word "third" is bolded, all the rest are not.

How can I programmatically discover which parts (text runs?) within each para have had additional formatting applied?
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to parse bold sections of a paragraph? Not Bold text but it comes up bold Pluviophile Word 7 10-22-2013 10:29 AM
Format Bold in one line makes all lines bold Nitte Word 2 02-07-2013 12:34 AM
How to parse bold sections of a paragraph? Set paragraph text to bold. Sorcerer13 Word 1 09-04-2012 11:08 AM
Export Outlook emails to Access & parse certain text elements smahale Outlook 0 01-18-2012 09:30 PM
parse, store and email a .tmp file from wordpad? scadaman29325 Office 0 09-28-2010 04:56 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:14 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