AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
As the world gradually discovers just how useful it really is, it’s turning out to be the gift that keeps giving. Set rngFound = txtRng.PowerPoint morph is a magic little transition that’s been around for a while now. '~~> Set the marker so that the next find starts from here Set rngFound = txtRng.Find(TargetList(i)) TargetList = Array("keyword", "second", "third", "etc") Option Explicitĭim txtRng As TextRange, rngFound As TextRange I have commented the code so that you will not have a problem understanding it. Paste this code in a module and then try it. Let's say we have a slide which looks like this If you want you can also change the color of the font. Here is an example which will search for the text in all slides and then make the found text BOLD, UNDERLINE and ITALICIZED. You could go out of the way to create a rectangular shape and place it behind the found text and color it but that is a different ball game altogether. I've adjusted my program to match the answer selected.ĪFAIK there is no inbuilt way to highlight the found word with a color. The code I selected as the correct answer below runs much more smoothly. Turns out that code worked, but was a performance nightmare. Set foundText = txtRng.Find(FindWhat:=element, MatchCase:=False, WholeWords:=True) TargetList = Array("First", "Second", "Third", "Etc") Here is the code I went with: Sub Keywords() I ended up finding my answer through the MSDN, but it was very close to the answer I selected as correct from what people submitted. With range.txtRng ' find text withing the range "shape, text frame, text range" Here is what I have so far in PowerPoint, it is in no way functional. Range.HighlightColorIndex = wdYellow ' highlight the keywords from the for loop yellow MatchAllWordForms = False ' and DO NOT search for all permutations of the word MatchWholeWord = True ' and is not part of a larger word MatchCase = False ' and is case insensitive Text = TargetList(i) ' that has the words from the array TargetList With range.Find ' find text withing the range "active document" TargetList = Array("keyword", "second", "third", "etc") ' array of terms to search forįor i = 0 To UBound(TargetList) ' for the length of the array I would like to replicate the effect in PowerPoint. I used some code from this site to make a macro to do a keyword search on Word docs and highlight the results.
0 Comments
Read More
Leave a Reply. |