![]() |
|
#1
|
|||
|
|||
|
I need a VBA that will go through all the selected text, and nothing more, and analyze each paragraph, then set each of those paragraphs that match ANY of the following conditions, to the style "Quote":
Any tips? Thanks in advance! |
|
#2
|
|||
|
|||
|
Austin,
Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oPar As Paragraph
Dim bStyle As Boolean
Dim oRng As Word.Range
For Each oPar In Selection.Paragraphs
bStyle = False
Select Case True
Case oPar.LeftIndent > 0.4 And oPar.RightIndent > 0.4: bStyle = True
Case Asc(oPar.Range.Characters.First) = 34
Set oRng = oPar.Range
oRng.Start = oRng.Start + 1
If InStr(oRng.Text, Chr(34)) = 0 Then
bStyle = True
ElseIf InStr(oRng.Text, Chr(34)) = Len(oRng.Text) - 1 Then
bStyle = True
End If
Case Else
'Do nothing
End Select
If bStyle Then oPar.Range.Style = "Quote"
Next oPar
lbl_Exit:
Exit Sub
End Sub
|
|
#3
|
|||
|
|||
|
Thank you so much again! You're so good at this, I appreciate it big time.
|
|
#4
|
|||
|
|||
|
I'll start posting my attempts. Thanks again for the help.
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Macro to Insert text into the beginning on specific paragraphs unless the paragraph is blank
|
caboy | Word VBA | 2 | 04-01-2015 07:00 AM |
Exporting from excel into a specific format
|
Bambi555 | Excel | 2 | 09-22-2014 08:08 AM |
Inputting a number into word in a specific format
|
Jo 4x4 | Word | 7 | 07-19-2014 12:45 AM |
Applying specific format to doc
|
jrodriguez | Word | 3 | 07-23-2012 08:38 PM |
| How to count cells containing data and meet certain criteria | AdamNT | Excel | 1 | 08-11-2006 11:51 PM |