When I run a script in Matlab or Excel VBA, the commands do not get registered in the history.
If I save the file and reopen the commands generated by the script are gone.

Any ideas how to fix this?


- - - Updated - - -

Searching the issue, I found that the command AddToHistory needs to be used.
Unfortunately could not find an example.
I would like an example for VBA and en example for Matlab.

Thank you