You are on page 1of 1

Pinyin Macros

http://www.pinyinjoe.com/pinyin/pinyin_macro.htm

Installation

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.

You might also like