iwebpaster.blogg.se

How to highlight a word in word
How to highlight a word in word













  1. #How to highlight a word in word full
  2. #How to highlight a word in word code

Options.With Microsoft Word drawings, users are able to convey complex concepts through illustrations. Options.DefaultHighlightColorIndex = wdWhite Options.DefaultHighlightColorIndex = wdViolet Options.DefaultHighlightColorIndex = wdTurquoise Options.DefaultHighlightColorIndex = wdTeal Options.DefaultHighlightColorIndex = wdRed Options.DefaultHighlightColorIndex = wdPink Options.DefaultHighlightColorIndex = wdGreen Options.DefaultHighlightColorIndex = wdDarkYellow Options.DefaultHighlightColorIndex = wdDarkRed Options.DefaultHighlightColorIndex = wdDarkBlue Options.DefaultHighlightColorIndex = wdBrightGreen Options.DefaultHighlightColorIndex = wdBlue Options.DefaultHighlightColorIndex = wdYellow SCheckDoc = "C:\Users\user name\Documents\TestWords.doc" My feeble attempt to use white text for some background colours has also failed.Ĭlearly, I am a baby macro writer~ can you set me straight?

#How to highlight a word in word code

On running the code it was clear black text on some colours was illegible. It seems the code below that I have modified selects every other TestWord, but I cannot see why. I wanted to highlight each in a different colour. I have a document with usually 2 or 3 keywords, sometimes up to 10. If NextColour > UBound(hColor) Then NextColour = 1 Options.DefaultHighlightColorIndex = hColor(NextColour) TColor = Array(1, 16, 1, 16, 16, 1, 1) ' items must match the hcolor items HColor = Array(7, 2, 4, 9, 13, 14, 11) ' etc for additional colors I suggest that you use the light grey colour instead of white because if the highlighting is removed then the text is invisible. The colour values in the arrays can be obtained from the WdColorIndex enumeration. Because the array indexes start at 0 NextColor also needs to start at 0. Rather than use many Case statements, a neater way is to use an arrays of colour values and use NextColour to index them. Your problem is that the colour settings are outside the For Each wrdRef loop, they need to be set inside the loop. SCheckDoc = "C:\Users\Grace\Documents\Macros\testchecklist.docx" If you could possibly bother to help me out here, I'd be truly grateful. I've googled it but I've not idea what to do, honestly, my field of expertise is the opposite of computers. Object variable or With block variable not setĪnd when i try to debug it, it highlights the 9th row of code, the one that says. I'm desperately trying to make this macro work, I've created a new macro, typed it in manually as i've read copy-paste sometimes doesn't work, i've double-checked for any typos and yet when i try to run it, an error pops up, saying this: They also should to be found at the beginning or ending of a phrase.

how to highlight a word in word

Or another example : 'allen john' but not in 'allen johnson'.Īnd indeed, also not 'allen' nor 'john' as a separate word. I would like that the macro highlights only stand-alone words and also stand-alone phrases, as 'work' but not in 'working' or as 'still work' but not in 'still working'. SCheckDoc = "C:\Users\dsrt1\Google Drive\Katie\Business Beacon Point\Copy editing\Tools\Macros\confusables.docx"

#How to highlight a word in word full

Could you point out what I need to change so it only highlights full word matches on my list?

how to highlight a word in word

I set matchwholeword to true, so I am not sure why this is happening. For example, I have "less" on my confusables list, and it highlighted the "less" portion of blessings. I ran the comparewordlist macro as a test, and it highlighted parts of words.

how to highlight a word in word

I'm an editor, and I would like to use this macro to draw my attention to words that are often used incorrectly or confused for another word, especially homophones which can escape my editorial eye. If you have many, many words in the word list, then the macro can take quite a while to run-20,000 Find and Replace operations is quite a few! If the document containing the words to check is named differently or in a different location, just change the line that sets sCheckDoc so that it has a different full path name for the document.īasically, the macro grabs each word from the word list and then does a Find and Replace operation using that word in the document. If you put the words you want checked into a document named “checklist.doc” in the C: drive, then the following macro can be used:Īll you need to do is have the document open that you want checked, and then run the macro. The first is to write your own macro that will do the comparisons for you. The word list is large, on the order of 20,000 words, and Paul is wondering what the best way to do this is. If the document being checked contains one of the words in the list, then the word in the document (not in the word list) needs to be highlighted by being made bold. Paul has a document that he needs to check against a word list contained in another document.















How to highlight a word in word