Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2005

Tip: Looking for answers? Try searching our database.

Reverse macro below

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jerry - 17 Feb 2005 20:10 GMT
I have this macro that displays the style name for all
paragraphs in a document. I use this to easily check to
make sure certain styles are used. Is there a way to
reverse this and have the style name removed?

Thanks

Sub TagParas()

Dim p As Paragraph
Dim sText As String
Dim sStyle As String

For Each p In ActiveDocument.Paragraphs
   sStyle = p.Style
   p.Range.InsertBefore "@" + sStyle + " = "
Next p

End Sub
Jean-Guy Marcil - 17 Feb 2005 20:43 GMT
Jerry was telling us:
Jerry nous racontait que :

> I have this macro that displays the style name for all
> paragraphs in a document. I use this to easily check to
[quoted text clipped - 15 lines]
>
> End Sub

Instead of doing this, why don't you display the document in Normal view,
and in the Tools menu > Options > Set the "Style area width" to 1 inch or
so?
Then when you want to scan for styles, just switch to normal view.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

Helmut Weber - 18 Feb 2005 08:39 GMT
Hi Jerry,

just for fun.
If it has to be:

Sub Test764()
Dim p As Paragraph
Dim r As Range
For Each p In ActiveDocument.Paragraphs
   Set r = p.Range
   r.End = r.start + Len(p.Style) + 4
   r.Delete
Next p
End Sub

But I'd rather use Jean-Guy's method.

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.