*Not Compatible with Office for Mac 2008 or Apple iWork. See FAQ for more info.
These macros are very simple to use, as easy as "1-2-3":
To run macros, in Word or Excel for Windows press <alt-F8> or add the macro to your Quick Access Toolbar. In Office for Mac, go to Tools > Macros. In Libre/OpenOffice, go to Tools > Macros > Run Macro...
Use The Right Font
To use this macro, the only other thing to remember is that you'll need to select a font that includes letters with these diacritics. Otherwise you may find that in each word the one letter with a tone will be in a different font.
In Ubuntu Linux, I've found the default "Liberation Serif" and the other "Liberation" fonts do not have everything we need, but Free Sans, DejaVu Sans, DejaVu Serif, "Ubuntu" and many others look great. Another free open-source option is Adobe Source Han Sans / Google Noto Sans CJK.
Macs have had Unicode fonts for years. Not every font on a Mac will have these letters, but worrying about Unicode fonts is mostly a Windows thing these days, and Microsoft is getting better and better about that too.
In Windows, use one of these:
*Windows Office 2010 includes all of these fonts, but Calibri and Cambria did not include all the necessary characters in Office 2007 until I installed Office Multi-Language Pack 2007.
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.
Click one of the download links at the top of this page, and copy/extract the file to your PC.
To install in Microsoft Office, open Word or Excel and in Windows press <alt-F8>, or on a Mac go to Tools > Macros. 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. Note my instructions in each macro on exactly where and how to paste it, especially the part about the "sub" and "end sub" lines. 99 times out of 100, the reason a macro doesn't work will be a mistake pasting it in during this step.
The MS Office Help files on this topic are actually are pretty good. Open Help, enter "macro" in the Help index, and drill down to info on creating a macro "from scratch". (Note that Excel can be especially difficult about security: you must enable macros, and in recent versions of Excel you must save your final spreadsheet as a macro-enabled file.)
To install in OpenOffice or LibreOffice, go to Tools > Macros > Organize Macros > LibreOffice (or OpenOffice) Basic to create a macro and paste in my code. Here's a link to someone offering more detailed help: 5 Steps to Creating an OpenOffice Macro. In his step 5, instead of writing a macro you would paste in one of mine, making sure to follow my instructions in the macro comments about deleting the "sub Main" and "end sub" lines automatically created for any new blank macro.
When running these macros in OOo or LibrO, if you get a message saying you need a "Java runtime environment" (JRE), that has nothing to do with me and you can run macros without it, but I know how to make that annoyance go away in Linux: install OpenJDK Java Runtime. This is easy in Ubuntu. Open Software Center, search for LibreOffice, click the "More Info" button, scroll down to find OpenJDK Java Runtime, select it and click the "Apply changes" button above.
The Help files on this topic included with Open/LibreOffice are not very detailed, but there is some information there. Look under "Macros" (plural) and click through "Organize Macros" to "LibreOffice Basic".
See also the Troubleshooting section of the Pinyin macro FAQ page. If you get ambitious, the Help files in the Basic editors (launched when you click the "Edit" button in the macro dialog) can help you add tweaks of your own. For example, you can tell the MS Word macro to search forward from your cursor instead of backwards by setting ".Forward=" to "True", or you can remove that feature entirely.
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, and there are the Phonetic Guide features of Word and Writer. With any 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 on Zhuyin and Pinyin ruby fonts, and Microsoft Word's Phonetic Guide, and this a brief discussion of Phonetic Guide in LibreOffice/OpenOffice (in my Ubuntu Linux section, but there is also a version of OpenOffice for Windows), which someone is trying to automate by developing an an extension called OOPinyinGuide.
Need More Help?
|Copyright © 2005 PinyinJoe.com. All Rights Reserved.|
|"Microsoft", "Windows", "Linux", "Ubuntu", "Apple", "Macintosh" and any other trademarks on this site are the sole property of their respective owners.|