So you want $VAR not to expand initially, only at the very last moment when the code is instantiated? Is that it? Actually, thinking about it, this makes perfect sense... it seems kind of stupid to expand it early, that binds it to one machine.
Then you must remove all calls to MacrosManager::ReplaceMacros() and instead insert exactly one just before the wxString containing the text is sent to wxScintilla.