# Latex Export multiple subtrees into separate files

I have a subtree that I want to export as a latex document. That subtree needs a fairly long preamble specific to it, so I want to compile the preamble into a separate file, which I can then call with \input during export.

Right now, I can get the desired result with this sort of document

* Exporting with a file input for export-latex-header
:PROPERTIES:
:EXPORT_FILE_NAME: Main
:END:

content of the main file

** style file                                                     :noexport:
:PROPERTIES:
:EXPORT_FILE_NAME: stylefile
:END:
#+BEGIN_EXPORT latex
\usepackage{xyz}
\usepackage{abc}
#+END_EXPORT


I then perform two exports.

1. I export the subtree **style file with the body-only option (selected from the export dispatcher), which gives me the file stylefile.tex as output with the two lines of LaTeX.
2. I export the subtree * Exporting... in the regular way, giving me Main.tex with the correct preamble, and during compilation, the \input'ed lines are compiled correctly.

Is it possible to automate the export process somehow, so that when I export the Main file, org-mode automatically exports the dependency, as well?

FWIW: I've tried defining a macro in org that expands to the desired pre-amble, but macro invocations in :EXPORT_LATEX_HEADER: are treated as verbatim, i.e., not expanded during export.