View Single Post
  #11   Report Post  
Posted to microsoft.public.word.docmanagement
Suzanne S. Barnhill
 
Posts: n/a
Default Word should allow me to sync find/replace options I choose again

Looks like the sort of thing that could be screwed up very easily by a
VBA-illiterate. g But thanks, I'll give it a try.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Graham Mayor" wrote in message
...
I know where you are coming from on this - however for such repetitive

work
I would setup the strings I wanted to find and replace in arrays as shown
below. Each item in the list vFindText is replaced by the corresponding
entry in the list vReplText. The macro then runs each (wildcard)

replacement
in turn. By editing those two strings you can quickly setup a variety of
replacements.

In this instance, groups of spaces are replaced with one
A space before a paragraph mark is removed
A space after a paragraph mark is removed
Groups of paragraph marks are replaced with one
Tabs are removed
and spaces with en-dashes(^0150) or hyphens are replaced with em-dashes
(^0151)


Sub ReplaceList()
Dim vFindText As Variant
Dim vReplText As Variant
Dim i As Long

vFindText = Array(" {1,}", "^13 ", " ^13", "^13{1,}", "^t", " [^0150-] ")
vReplText = Array(" ", "^p", "^p", "^p", "", "^0151")

Selection.HomeKey Unit:=wdStory
With Selection.Find
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = False
.MatchWildcards = True
.MatchSoundsLike = False
.MatchAllWordForms = False
.Format = True
.MatchCase = True
For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText(i)
.Execute replace:=wdReplaceAll
Next i
End With
End Sub


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Suzanne S. Barnhill wrote:
I wouldn't know what to ask for. A single macro including all the
possibilities is not practical (the replacement requirements are
varied*) and a separate macro for each possibility would be more
trouble than it's worth. Short of recoding the entire F&R feature, I
don't see this being really very helpful.

*For the project I'm currently working on, they include:
Multiple spaces with single space
Multiple paragraph marks with single paragraph mark
Tab character with nothing
Space + paragraph mark with paragraph mark
Paragraph mark + space with paragraph mark
Space + en dash (or hyphen) + space with em dash
Probably others that I'm forgetting

No one document will require all of the above, but most will require
at least a couple. The current project is short stories by dozens of
writers, most of whom tend to use Normal style exclusively, press Tab
for a first-line indent, press Enter twice to add space, space twice
between sentences, and invariably leave a lot of stray spaces and
empty paragraphs because they work with nonprinting characters hidden
(typically there will be the better part of a pageful of empty
paragraphs at the end of the document and usually at least one space
at the end of every paragraph). And this doesn't even count the ones
that "right-align" copy by pressing Tab repeatedly or the ones that
center titles using the spacebar. sigh


"Graham Mayor" wrote in message
...
You only have to ask

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Suzanne S. Barnhill wrote:
As you yourself have pointed out, recorded macros based on Find and
Replace often don't work as expected, and, as I don't write VBA, I'm
not up to editing them.


"Graham Mayor" wrote in message
...
I meant that you could store your regular searches as macros

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Suzanne S. Barnhill wrote:
?


"Graham Mayor" wrote in message
...
Still not presuaded to go the vba route then

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Suzanne S. Barnhill wrote:
Even better would be to have a selection of F&R "profiles" or
something akin to AutoText entries that would be saved between
Word sessions. There are certain combinations I search for
repeatedly (two spaces with one space, ^p^p wit ^p, etc.), and
it would be neat to be able to just say, use F&R combination 1,
2, 3, or whatever.


"mary branscombe"
wrote in message
...
Suggestion. When I find and replace, I can go back and choose
something I've looked for, or something I've replaced. Picking
what I looked for from the list doesn't change what I'm
replacing; it would be nice to have an option that says
'replace with the same text used last time' so that when I
pick FindText1 I get ReplaceText1 in the replace box
automatically - make it a checkbox so it's not the default
behaviour. when i have a set of Find/Replace changes to make
in several different documents, this would save time and avoid
msitakes.

----------------
This post is a suggestion for Microsoft, and Microsoft responds
to the suggestions with the most votes. To vote for this
suggestion, click the "I Agree" button in the message pane. If
you do not see the button, follow this link to open the
suggestion in the Microsoft Web-based Newsreader and then click
"I Agree" in the message pane.






http://www.microsoft.com/office/comm...ocmanagemen t