Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How would I go about having Word 2007 select an exact number of words from the cursor position? The count according to Non-Asian words would be particularly helpful.

share|improve this question
add comment

1 Answer

You can use VB to do this. Place the following code into the VB browser (Ctl + F11). You can place it in the NewMacros folder and it will be available in all the new documents you create. Or you can place it in the ThisDocument for it to only be available in the document you are working with.

Sub SelectWords()
Selection.MoveRight Unit:=wdWord, Count:=10, Extend:=wdExtend
End Sub

Adjust the Count:= number to be the number of words you want selected.

enter image description here

To run the macro, open the marco window with Atl + F8 and run SelectWords.

enter image description here

share|improve this answer
    
Thank you for your response. I ran the macro and it did what it was supposed to, but it seems this method will only work for files that have nothing but English in them. When I use files that have both Japanese and English in them, it counts the Japanese characters (in groups), as well as the tags used by the translation program. Sentences are formatted like this: {0>Japanese text<}0{>English text<0}. Obviously this could become overly complicated, so what about limiting the selected text to a certain font? –  By137 Sep 7 '12 at 16:18
    
The code was written to just count words. Surely the extra characters are confusing how it counts, so I understand why it didn't work. From your question, I did not realize there were Japanese characters within the sentences. Sorry, I am not sure how to get it to only count words with a certain font type. –  CharlieRB Sep 7 '12 at 17:49
    
Can you post an example? Maybe there is a way to figure it out using the special characters. –  CharlieRB Sep 7 '12 at 18:06
    
Yeah, sorry about the lack of information in my original question. Here is a simple example: {0>第6章<}100{>Chapter 6<0} What should be a word count of 2 is 14. The tags are formatted as subscripts if that makes a difference. The reason I thought this would be possible (without writing hundreds of lines of code) is that the word count function in Word has a line for Non-Asian characters that always gives the correct count. –  By137 Sep 8 '12 at 2:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.