| |||||||||||||
|
|
Pinyin Macros for MS Word and Excel Automatically convert pinyin with tone numbers
|
||||||||||||
See also my third-party add-ins page for pinyin solutions from others, including Pinyinput, a free Pinyin with tone marks IME for Windows. Having trouble with Word's Phonetic Guide for placing pinyin "ruby text" above your Chinese characters? See the Phonetic Guide FAQs for help. |
Pinyin Macro Instructions
Overview
Use These Fonts
Installation
Ruby Text
Pinyin Macro Help
FAQs & Technical Notes
Contact Information
These macros are very simple to use, as easy as "1-2-3":
Simple as that!
*In Excel, you can assign a keyboard shorcut to each macro by clicking the Options button you will see there. In Word, you may want to raise this macro to the top of the list by adding "aa" to the front of the name so you can just hit <Enter> instead of double-clicking on the macro name.
To use this macro, the only other thing to remember is that you'll need to select one of the following fonts:
Arial |
![]() |
In most recent versions of Office, these "core" fonts have been updated to include at least enough of the Unicode character set to display pinyin with tone marks. |
| Arial Unicode MS | The default Unicode font, included since MS Office 2000. Safest for use in Access databases too. | |
| Lucida Sans Unicode | The default Unicode font in earlier versions of Windows. Also used in Mac systems. |
Windows Vista and Office 2007 include all of these fonts. Just avoid using Office 2007's default font, Calibri, which does not include all the characters you need. You may not notice at first, but if you use Calibri some but not all of the letters will convert to Arial and the final result will be ugly.
Office XP (2002) and 2003 include the latest Arial, Courier New and Times New Roman, and those editions also normally install the Arial Unicode MS font as the "Universal Font", also known as the "Unicode Font" as part of International Support.
In Office 2000 that font is an option. If you did not install it, for either XP 2002/2003 or 2000, follow the instructions for "Installing the Unicode Font" on Microsoft's "Administering Fonts for Office XP" page.
I'm not sure how to find that font if you're missing it in older versions of Macintosh Office, but I bet Mac users don't even have this kind of problem.
Again, you do not need to worry about missing any of these fonts in Windows Vista or Office 2007, or for most installations of Office XP/2002/2003, so just go ahead and try using the macro first before getting concerned with this.
«TopInstallation
Click one of the download links at the top of this page, and copy/extract the file to your PC.
To install, open Word or Excel as appropriate and press <alt-F8> (or on the Mac <Cmd-F8> right? It's been awhile...). Type a name for the macro and hit the "Create" button. Then open the downloaded file, select all the text and copy it into a blank macro. Paste it between the lines already in there, "Sub" and "End Sub", being careful not to erase those!
The Excel macro must have a very specific name, noted on one of the first comment lines in the file. You can call it anything when you first create the blank macro, but then follow the instructions in the comment lines for renaming. If you don't do this, the macro will convert text in selected cells but the versions for worksheets and entire workbooks will not run. Also, if your Excel is set to insert the command "Option Explicit" into a new macro module, make sure you end up with only one instance of that in each module.
If you need further help creating or saving a macro, the Help files in Word and Excel have all the information you need. Just enter "macro" in the Help index and drill down to info on creating a macro "from scratch". Excel can be especially difficult about security: you must enable macros, and in some versions of Excel you must save your final spreadsheet as a macro-enabled file. See also the Troubleshooting section of the pinyin macro FAQ page.
If you get ambitious, the Help files in Visual Basic editor (launched when you click the "Edit" button in the macro dialog within Word or Excel) can help you add tweaks of your own. For example, you can tell the Word macro to search forward from your cursor instead of backwards by setting "Forward=" to "True".
«TopRuby Text
Although you can use this macro to create "ruby" text (small phonetic transcriptions aligned above or alongside Chinese characters), there is an easier way: there are inexpensive Chinese character fonts available that include pinyin ruby text. MS Word's Phonetic Guide can help you do the same thing without buying a font, but I hate that feature...it really is not a finished product. With either of these options you'll have to input the Chinese characters first of course. See this section of my zhuyin setup page for more information: zhuyin and pinyin ruby fonts and Word's Phonetic Guide.
«TopNeed More Help?
There is a Troubleshooting section on the macro FAQ page. I've tested these macros in the Windows versions of Office 2007 (use one of the fonts listed above, not the default Calibri), Office 2003, Office XP 2002 and Office 97. I am told they also work in Macintosh Office 98 through 2004, and maybe even the mid-nineties version 4.2, but Mac Office 2008 is not compatible with this type of macro. I hope to get these VBA macros converted to AppleScript soon. Please send questions, comments or suggestions anytime via the contact page.
| Copyright © 2005 PinyinJoe.com. All Rights Reserved. |
| "Microsoft", "Windows", "Vista" and any other trademarks on this site are the sole property of their respective owners. |