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 / December 2004

Tip: Looking for answers? Try searching our database.

Visual Basic Macro question for Word --Parsing

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dado_maker - 29 Dec 2004 23:29 GMT
Hi,
I would like to write a vis basic macro that will search the begining of
each line of my doc, that does not start with a space " " and change the
style of those lines.

I need to parse thru each line to search thru each string in my word
doc.

I didnt see a way using the macro recorder and believe I need to code
this if possible.
Any help would be appreciated!

Thanks,
Dado
Jonathan West - 29 Dec 2004 23:40 GMT
Hi dado

First and most important question - does each paragraph have just a single
line? In other words, can you iterate through paragraphs instead of through
lines?

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup

> Hi,
> I would like to write a vis basic macro that will search the begining of
[quoted text clipped - 10 lines]
> Thanks,
> Dado
Greg Maxey - 30 Dec 2004 00:18 GMT
dado_maker,

If each line is a indidual parapraph (i.e., no wrapped lines or line breaks)
then something like this may work for you:

Sub ScratchMacro()
Dim oPar As Paragraph
Dim myRange As Range
For Each oPar In ActiveDocument.Paragraphs
 Set myRange = oPar.Range
   If Not myRange.Characters.First = " " Then
     oPar.Style = "Body Text"
   End If
Next
End Sub

Signature

Greg Maxey/Word MVP
A Peer in Peer to Peer Support

> Hi,
> I would like to write a vis basic macro that will search the begining
[quoted text clipped - 10 lines]
> Thanks,
> Dado
dado_maker - 30 Dec 2004 02:09 GMT
Greg,

Sweet!
Thanks,
dado_maker

> dado_maker,
>
[quoted text clipped - 30 lines]
> > Thanks,
> > Dado
dado_maker - 30 Dec 2004 02:10 GMT
Greg,

Sweet!
Thanks,
dado_maker

> dado_maker,
>
[quoted text clipped - 30 lines]
> > Thanks,
> > Dado
dado_maker - 30 Dec 2004 02:10 GMT
Greg,

Sweet!

Thanks,
dado_maker

> dado_maker,
>
[quoted text clipped - 30 lines]
> > Thanks,
> > Dado
Jezebel - 30 Dec 2004 00:44 GMT
You can do this with Find and Replace --

1. Search for "^p "  (without the quotes) and replace with "^pXXX"   (XXX
can be any string that doesn't otherwise occur in your document.)

2. Search for XXX and replace with nothing, format = stylename.

> Hi,
> I would like to write a vis basic macro that will search the begining of
[quoted text clipped - 10 lines]
> Thanks,
> Dado
 
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.