Japanese characters

RedBeard

Well-known Member
Joined
May 16, 2015
Messages
858
More Japanese oddities.

As I'm continuing work on Japanese worksheets, I was wondering if anyone knows of a way to automatically convert western characters (A, B, C... etc.) to Japanese ones.

As an example, if a user types "mo" this would convert to "も", the equivalent character in Japanese.

I've seen horrible solutions with massive arrays to match all possible inputs, but I've seen not clean way of doing it.

The built in constants to use with StrConv (vbKatakana and vbHiragana) are of no use as they only switch between the two.

I'm guessing this is not even remotely possible, but if there is a way, it'd be very nice.

Anyone with clever ideas?
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
A quick search on the internet shows that Japanese computer keyboards are around $45.
 
Upvote 0
Hi, RedBeard.


Do you need macro to convert Roma-ji (e.g. "mo") into Kana (e.g. "も") ?


The follows are Japanese websites, can you read it?
http://park11.wakwak.com/~miko/Excel_Note/15-03_celldata.htm#15-03-57


No. 57 "roma2kana" is UDF which converts Roma-ji into Kana.


1st arg : roma ... Roma-ji
2nd arg : katakana ... True : convert into Kata-Kana , False : convert into Hira-Kana


e.g. "tsunoda" ... It's my name.


roma2kana("tsunoda",True) ... "ツノダ"
roma2kana("tsunoda",False) ... "つのだ"




In addition, No. 56 "kana2roma" before one converts Kana into Roma-ji to reverse.
 
Upvote 0
Hi, RedBeard.


Do you need macro to convert Roma-ji (e.g. "mo") into Kana (e.g. "も") ?


The follows are Japanese websites, can you read it?
15-03_celldata


No. 57 "roma2kana" is UDF which converts Roma-ji into Kana.


1st arg : roma ... Roma-ji
2nd arg : katakana ... True : convert into Kata-Kana , False : convert into Hira-Kana


e.g. "tsunoda" ... It's my name.


roma2kana("tsunoda",True) ... "ツノダ"
roma2kana("tsunoda",False) ... "つのだ"




In addition, No. 56 "kana2roma" before one converts Kana into Roma-ji to reverse.

Thanks a million!

ありがとうございました。
 
Upvote 0
Question, I've tried working with this, but I am having some issues.

If I type =roma2kana(A1,FALSE) in the formula field for a cell, it doesn't get recognised as a formula.
Also, If I try to implement it via a commandbutton, I get an error on this line
Code:
  roma = StrConv(roma, vbNarrow Or vbLowerCase)
with
Invalid procedure call or argument
.
Not quite sure what I'm doing wrong here, but any help would be most welcome.

Thanks in advance.
 
Upvote 0
Hi, RedBeard.


The error is caused by Locale.


StrConv Function
Syntax
StrConv(string, conversion, LCID)


LCID
Optional.
The LocaleID, if different than the system LocaleID.
(The system LocaleID is the default.)


The conversion argument settings are:
Constant Value Description
vbWide* 4* Converts narrow (single-byte) characters in string to wide (double-byte) characters.
vbNarrow* 8* Converts wide (double-byte) characters in string to narrow (single-byte) characters.
vbKatakana** 16** Converts Hiragana characters in string to Katakana characters.
vbHiragana** 32** Converts Katakana characters in string to Hiragana characters.

* Applies to East Asia locales.
** Applies to Japan only.

Note
....
The constants vbWide, vbNarrow, vbKatakana, and vbHiragana
cause run-time errors when used in locales where they do not apply.

Microsoft Locale ID Values
https://msdn.microsoft.com/en-us/library/ms912047(v=winembedded.10).aspx


(Language) (Country/Region) (Locale ID)
Japanese Japan 1041





Please try follows.

Code:
-- roma2kana --
> roma = StrConv(roma, vbNarrow Or vbLowerCase)
roma = StrConv(roma, vbNarrow Or vbLowerCase[COLOR=#ff0000], 1041[/COLOR])


> If Not katakana Then roma2kana = StrConv(roma2kana, vbHiragana)
If Not katakana Then roma2kana = StrConv(roma2kana, vbHiragana[COLOR=#ff0000], 1041[/COLOR])


-- kana2roma --
> kana = StrConv(kana, vbHiragana Or vbWide)
kana = StrConv(kana, vbHiragana Or vbWide[COLOR=#ff0000], 1041[/COLOR])
 
Upvote 0
Hi, RedBeard.


The error is caused by Locale.




Microsoft Locale ID Values
https://msdn.microsoft.com/en-us/library/ms912047(v=winembedded.10).aspx


(Language) (Country/Region) (Locale ID)
Japanese Japan 1041





Please try follows.

Code:
-- roma2kana --
> roma = StrConv(roma, vbNarrow Or vbLowerCase)
roma = StrConv(roma, vbNarrow Or vbLowerCase[COLOR=#ff0000], 1041[/COLOR])


> If Not katakana Then roma2kana = StrConv(roma2kana, vbHiragana)
If Not katakana Then roma2kana = StrConv(roma2kana, vbHiragana[COLOR=#ff0000], 1041[/COLOR])


-- kana2roma --
> kana = StrConv(kana, vbHiragana Or vbWide)
kana = StrConv(kana, vbHiragana Or vbWide[COLOR=#ff0000], 1041[/COLOR])

This works beautifully.
Again I learn something, thank you very much!
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,144
Members
448,552
Latest member
WORKINGWITHNOLEADER

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top