Thread: Spelling Macro
View Single Post
Old 12-01-2008, 01:39 PM   #7
=X=
Wizard
=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.=X= ought to be getting tired of karma fortunes by now.
 
=X='s Avatar
 
Posts: 3,671
Karma: 12205348
Join Date: Mar 2008
Device: Galaxy S, Nook w/CM7
Quote:
Originally Posted by PieOPah View Post
Is there a more efficient way of doing this - or is there already a macro available I can use?

Many thanks,
Yes there is a much more efficient way of doing this, but it gets more complicated.

A better way would be to do a while loop with a case statment inside
Code:
PSUDO CODE
Match = "color|honor|etc..."

Look for match
While (Match not found)
select (match)
case "color"
replace("color","colour")
case "honor"
replace("honor","honour")
end select
Look for match WEND
This way you only search through the document once and replace each word with the correct selection as you find them.


All the source examples you need are found in the tool BookCreator except for the case statement but a google on "vba select case example" should give you a good example on how to write one.

=X=

Last edited by =X=; 12-01-2008 at 01:41 PM. Reason: close select statment
=X= is offline   Reply With Quote