Part II: Programming Microsoft Access
574
FIGURE 15.18
Collapsed items help simplify the Macro Designer surface
Saving a macro as XML
A completely hidden feature of Access 2010 data macros is the ability to copy them from the
Macro Designer and paste them into a text editor as XML. Access internally stores macros as XML,
and copying a macro actually means copying its XML representation.
There are a couple reasons you may want to save a macro as XML:
l (^) To e-mail the macro to someone else.
l To archive it as a backup. Because each table contains only one copy of each event
macro (AfterUpdate, for example) there’s no easy way to set aside a copy of the macro
before embarking on changes to the macro’s logic.
Figure 15.19 shows a simple macro’s XML pasted into Windows Notepad.
The XML saved in a text file can be pasted right into the Macro Designer surface and Access will
display it as usual. The paste action works exactly as it does in Microsoft Word or a plain text edi-
tor. The pasted macro actions appear exactly where the cursor is when the paste is initiated.