Using macros

Citavi has a built-in macro editor. Macros are mini-programs that run within Citavi. They let you do things with your project that are not possible with Citavi's standard features. For example, you could batch move contents from one field to another, or sort categories alphabetically.

The macros here show the wide variety of possibilities for use:

Citavi macros are written in the C# ("C sharp") programming language and interact with the Citavi object model, which is specific to a version of Citavi. This means that macros from earlier versions of Citavi usually will not work in a later version of Citavi.

In the Citavi Support portal (currently in German only) you can find a number of macros that can be downloaded. Here's how to use them:

  1. Macro files have the .cs file extension. If you received the macro in a ZIP archive, be sure to extract it from the ZIP first.
  2. Start Citavi and open the project you want to work on.
  3. Important: Back up the project before running a macro on it (File > Create backup). Creating a backup is very important because the changes made by a macro cannot be undone!
  4. Many macros apply to the current selection only, so if you want them to apply only to some references, use the filter or search features to create a selection first. (You can identify a macro that applies to the current selection because the macro's program code will contain .GetFilteredReferences() somewhere.)
  5. Press Alt+F11 or click Tools > Macro editor to open the macro editor. It can take a few seconds for the macro editor to open.
  6. In the Macro Editor, on the File menu, click Open and choose the macro file (.cs) you prepared in step 1.
  7. Click Compile. No errors should appear in the lower pane of the window.
  8. Click Run to run the macro. You will be asked to confirm that you created a backup. If you haven't, cancel, create the backup, and then continue.