![]() |
|
![]() |
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
![]()
Good morning!
I have a script I wrote about a year ago that was cumbersome to begin with but is becoming more and more unwieldly as time goes on! I'm not very good at VBA, but I can work with rudimentary syntax if it's easy enough for me to see and figure out what is going on and what I have to do. The simple code I found via recording keystrokes puts the structure below into my macro. I now have somewhere between 40 and 50 of these search and replace code blocks (!!!): Code:
'---------------------------------------------- Selection.HomeKey Unit:=wdStory Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "Orbis factor" .Replacement.Text = "Órbis fáctor" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll '---------------------------------------------- i.e., in the example above, the document I get that I need to edit is missing emphasis accents in the Latin, such as this: Orbis factor For clarity's sake, I need to edit to show syllable emphasis, like this: Órbis fáctor If at all possible, it would be easier to maintain a word list (preferably contained within the macro itself and not accessing the information from an external source -- not sure if this is procedure but in an automation language I do now how to use quite a bit better than VBA, this is a common procedure). This type of solution with a word/phrase list would mean that I can then keep everything orderly and easy to maintain as I'd put all these words/phrases to be edited in alphabetical order (with first word/phrase being how it gets sent to me, followed by accented or diphthong corrections I need to make) ... : ae æ Dicit Dícit Est Ést Nunc Núnc Orbis factor Órbis fáctor (etc., etc.) This may not be even possible, I just don't know. All I know is that I need a structure that is as easy to work with as the simple, 1-item-per-row list above (?). I hope that I've explained okay. If more clarification is needed, please let me know. Thank you! ![]() |
#2
|
||||
|
||||
![]()
This has been addressed before. See, for example: https://www.msofficeforums.com/word-...ing-macro.html
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
KPS2019 | Word | 4 | 05-31-2019 04:04 PM |
![]() |
knpaddac | Word | 1 | 01-14-2019 01:16 PM |
Trying to add space between lines of bulleted text and a new header but both lines are moving??? | Martin_d35 | Word | 2 | 02-10-2017 07:13 AM |
Eliminating extra lines when pasting copied text | debip58 | PowerPoint | 0 | 09-14-2015 03:22 PM |
![]() |
BeerStud | Mail Merge | 1 | 11-28-2014 06:29 PM |