View Single Post
 
Old 10-07-2016, 06:13 AM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2013
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,158
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

You could simplify the meetsomecondition setting or even avoid it completely with the following modifications
Code:
Sub BoldStart()
  Dim p As Paragraph, i As Integer
  Dim oRng As Range, meetssomecondition As Boolean

  For Each p In ActiveDocument.Paragraphs
    Set oRng = p.Range
    i = InStr(1, oRng.Text, "-")
    'meetssomecondition = i > 0
    'If meetssomecondition Then
      oRng.End = oRng.Start + i - 1
      oRng.Font.Bold = True
    'End If
  Next p
End Sub
The remmed out lines don't matter if there is no dash in the paragraph since the range is collapsed to an insertion point on those paragraphs.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote