Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Paragraph alignment in a macro
Hi everybody,
I'm trying to write a macro, and one of the first steps I want is to delete any text that is center-aligned. I tried to record a macro, using the find and replace, but then when I ran the macro I couldn't make it work. I don't know much about writing macro code, does anybody know how to put this into a macro? I only need a little snippet of code, if you can. Thanks! jezzica85 |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Paragraph alignment in a macro
Dim i As Long
With ActiveDocument For i = .Paragraphs.Count To 1 Step -1 If .Paragraphs(i).Alignment = wdAlignParagraphCenter Then .Paragraphs(i).Range.Delete End If Next i End With -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "jezzica85" wrote in message ... Hi everybody, I'm trying to write a macro, and one of the first steps I want is to delete any text that is center-aligned. I tried to record a macro, using the find and replace, but then when I ran the macro I couldn't make it work. I don't know much about writing macro code, does anybody know how to put this into a macro? I only need a little snippet of code, if you can. Thanks! jezzica85 |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Paragraph alignment in a macro
Hi Jezzica,
Sub Test345() Dim rDcm As Range Dim rPrg As Paragraph Set rDcm = ActiveDocument.Range For Each rPrg In rDcm.Paragraphs If rPrg.Alignment = wdAlignParagraphCenter Then rPrg.Range.Delete End If Next End Sub -- Greetings from Bavaria, Germany Helmut Weber, MVP WordVBA Win XP, Office 2003 "red.sys" & Chr$(64) & "t-online.de" |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
SQL Prompt When opening merged documents | Mailmerge | |||
Macro Button Won't Stay on Toolbar | Microsoft Word Help | |||
Paragraph alignment in table Word 2003 | Page Layout | |||
Possible bug when recording a Word Macro | Microsoft Word Help | |||
Page breaks in justifed text | Microsoft Word Help |