Skip to main content

Applying a Macro

How to use Macros in PDF2XL

Team PDF2XL avatar
Written by Team PDF2XL
Updated over 2 months ago

A macro is a handy script that you can add to your PDF2XL program to modify your document during conversion so that the output is exactly how you want it.

This is useful when you have a document that needs to be reorganized in a way that cannot be managed in PDF2XL, itself, due to its complexity.

Please note that we do not write macros. These need to be created by the user.

NOTE: Macros can be run in Excel after the conversion if the following method fails to work. Please see Microsoft Support for instructions.


To use a macro in PDF2XL:

  1. Create your .vbs macro file and save it to your computer.

  2. Open your PDF file in PDF2XL.

  3. Apply your layout.

  4. On the Convert tab, select the Macro button.

  5. On the prompt, click "Load" and select the saved .vbs file on your computer.

  6. In the "Function to call at start" field at the top of the prompt, enter the "Sub" name without any spaces or the end brackets.

    1. For example, "Sub transform()" should be simply "transform".

  7. Click "OK".

  8. Click the Convert button to run your conversion with the macro.


*Note that if you are using .bas macros, they cannot be loaded into the dialog, since we call the macros from outside of Excel. (See here)
You can, however, just copy and paste the code into the macro field.

There is a 30,000 character limit in the macro field.

Did this answer your question?