Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Feb 2003
    Location
    London, Gtr London
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Detecting Japanese in a Word DOC (2000)

    How can I detect from within a VBA macro whether a document contains Japanese text?

    I've thought about searching for the presence of Japanese fonts, but there is always a chance that another Japanese typeface is in use other than the usual MS Minko font, for example.

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Detecting Japanese in a Word DOC (2000)

    Text can have a language assigned to it; this is useful for spell checking. I *assume* that Japanese character text would have a language assigned to it that contains the word Japanese. But checking all the text in a document for its language (every character can have its own language!) would be inefficient. Hmmm...

  3. #3
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Detecting Japanese in a Word DOC (2000)

    I think "Edit > Find > Format > Language > Japanese" should locate any Japanese text.
    If you need a macro, the macro recorder should give you some code.

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> Klaus

  4. #4
    New Lounger
    Join Date
    Feb 2003
    Location
    London, Gtr London
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Detecting Japanese in a Word DOC (2000)

    Harder question:

    Suppose you want to know whether someone has typed Japanese text into a TextBox on a form?

  5. #5
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Detecting Japanese in a Word DOC (2000)

    You could probably check if the text contains characters from the Hiragana (U+3040-U+309F) or Katakana (U+30A0-U+30FF) code blocks.

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16> Klaus

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •