I could be wrong, but the Module UI webpart may not be using the same Macro Resolver that the normal pages uses, which may mean in an HTML editor it has that context of "CurrentDocument" but not in the Module UI.
If you go to System -> Macros -> Report, and select the object type of "UI Element" i do not see a CurrentDocument in it's context. But check through the available options and see if you can find something that you can use instead (Maybe EditedObject.FormClassID?)
It may also be possible to simply implement a custom macro to do the logic you need...