Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Word - Force italics on misspelling 5

Status
Not open for further replies.

pachad

Programmer
Mar 13, 2003
45
US
When transliterating foreign words into English, I format them with italics.

For example, "The correct way to pronounce groups in German is grup-pen".

Now, since most of these transliterations are not valid English words, MS Word flags them as misspelled with the curvy red underline. So when I finish the whole document, I look over the document searching for those misspelled words, and manually convert them to be italic format.

Can anyone suggest a macro or something I could run on a completed document, which would convert all misspelled words into italic format?

i.e. The misspelled word "grup-pen" would be automatically changed into "grup-pen".
 
Hi pachad,

I don't think you can do this without code, but a simple macro should work ..

Code:
[blue]For Each MisSpelling in ActiveDocument.SpellingErrors
    MisSpelling.Italic = True
Next[/blue]

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at [url=http://www.vbaexpress.
 
Do you have the option to flag those words as [Do not check spelling or grammer]? You ought to find it from the Menu, [Tools], [Language]. [Set Language].

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
The best solution is too use a character style.

Format, Style, New
In the name box put ForeignText
Change the style type to character

Press the format button
Click Font and select Italic

Press the format button again
Click Language and select No proofing

Click the add to template option to save in Normal.dot and thus have avialable for all documents.

If you are going to use often there is a button to assign a short cut key to your style such as Alt+Ctrl+X

To use select the text and click on the style dropdown box and choose your new style or use the shortcut key.

If the style does not show in the drop down list repeat with the shift key pressed.

 
Thank you Tony and Cheerio.

Tony, like you said, simple is best.

Cheerio, I am afraid of styles...(-:

Thanks again.

-pachad
 
Thanks for the stars.

Don't be afraid of styles - they are simply a collection of formats that have been given a name. In my case the collection was Italic + No proofing.

The two solutions could be combined.
In Tony's code can be adapted to

MisSpelling.Style = "ForeignText"

Because my style turns off the spelling check for those words you get rid of the red wavy underline.
 
cheerio...big thumbs up from me. And a star as I strongly promote the use of styles. Word is DESIGNED around styles. A note to pachad - you ARE using styles. Even if you do nothing but a manual format (bad bad bad) you are doing a manual format of the Normal style. All text in Word has a style.

Your documents will be much improved if you create, understand, and USE styles fully.

Gerry
 
As far as using a style in this case, it would be necessary to go to every word and select it and then apply the style. Whereas, the macro automatically finds and italicizes the misspelled words.
 
Ben

If you read my last post above you will see that Tony's macro can easily be altered to apply the style instead of applying italics. It is therefore not necessary to manually apply the style to each word.

If this were my own project I would combine the two approaches. In addition, for a long document I would get the macro to ask for confirmation on each word simply for fear of missing a genuine spelling error. The advantage then is that the red wavy line would be left on the misspelled words.

The other reason I prefer the style is that the foreign words would be removed from scope on future spelling checks.

Cheerio

PS Tony's initial contribution was just as important as my own and I am going to give him a star as I learned something.
 
cheerio,

I understood your style would be toggled on at the beginning of each foreign word, and the off again when I finished the foreign word. This would tend to slow my typing down, as I may have ten foreign words in a single paragraph.

Using the macro to assign the style, would, as you correctly point out, remove the underlines from all misspelled words, which Tony's solution does not.

For my needs, Tony's solution is best.

BTW - Can you (or fumei) recommend a good book/website to learn MS Word styles from? This is not the first time I've been told they are powerful, but I am still afraid of them...
 
follow-up...

Okay, I re-read your post, and followed your instructions.

Now I have a problem.

I assigned a shortcut key to the style. Works great. It switches into italics, and does not highlight any spelling mistakes. However, I can not seem to turn it off when I finish typing the word! [pc1]

I assigned a shortcut key to the "normal" style, and when I finish the foreign word, I hit the shortcut keys, but the next word is still formatted in the "nospellcheck" style.

Any ideas?
 
Congratulations on your persistence - I think you are almost there.

My comments below apply to Word 2000. I have not verified later versions.

I assume that you did create the nospellcheck style as a character style rather than as a paragraph style otherwise it would automatically apply to the whole paragraph.

I am also assuming that you are applying the style as you go along with the shortcut rather than using a macro.

Ideally you need to tell Word that you have finished typing the foreign word. You can do this by typing a space or a punctuation character. It is only when the word is finished that the wavy underline appears.

If you type the 4 letters:

pere

and then apply the shortcut you will have the problem you describe because Word thinks the word is unfinished so it will continue the style.

If you type those 4 letters followed by a space the wavy underline will appear. You can then move back into the word and apply the style. Word does not apply it to the space so the rest of the sentence is ok.

Having created the problem, there is a built in character style called default paragraph font that would reset you back to the normal style rules. You cannot reset by using the normal style itself because you are trying to cancel out a character style with a paragraph style.

Now you cannot assign a shortcut key to default paragraph font through the styles menu because this style cannot be changed and the modify button is grayed out.

However, you can do it another way.

Go to Tools, Customize

Click on the Keyboard Button

Scroll down to Styles and select the Default Paragraph Font

Now give it a short cut.

Hope this helps.
 
BenRowe - I was never suggesting a manual application of styles on words. This is on general principle. My point was that if you understand the use of styles, and USE them, then using them for OTHER purposes is not hard.

As cheerio points out, Tony's contribution is easily adapted for styles.

Spell checking produces misspelling objects, and they have a style attached to them, by code. When the need is no longer there - AND as cheerio mentions twice, that the spekling style is a Character style(not a paragraph) style - it is not difficult to revert the words (identified by the nospelling check style) back to the original style of paragraph.

Gerry
 
cheerio-

Both your assumptions are correct. I followed your advice, and now it wirks grayte! ;-)
Code:
[tt][blue]Do [/blue]
   Type document up to the foreign word. 
   Press shortcut to nospellcheck style. 
   Type foreign word. 
   Press space after completing foreign word. 
   Press shortcut for default paragraph font. 
   Continue typing. 
[blue]Loop Until [/blue] myDocument.Completed = [blue]True [/blue][/tt]

Take another star!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top