How to set return variable result in a "called macro"?

I have a Macro that calls another macro to get a future date using a web service with some special logic.

Back in the main macro, I am writing a customer telling him when his invoice is due (the due date comes from the “called” macro).

So, what I want to do is somehow capture the variable result from the ‘called’ macro so I can use that date inline in the main macro for the “due date”.

I have ‘sort-of’ solved this (not optimal, probably), by setting the called macro result to the clipboard. Then, in the main macro, I reference that clipboard value.

This method works, but I’m just wondering if there’s a better way and how exactly I would set that up in KM.


Hi Oliver,

How exactly are you getting the result in the called macro now? If you can share a screenshot of your macro, or at least of the relevant parts that get the result and where it would be referenced, I imagine we should be able to show you how to store and reference it from a KM variable, which probably would be better than going through the clipboard in this case.

Actually, I think it might be working.

In the ‘called macro’, I have a “GET URL” call where I’m saving the results from a web service call to a variable.

Then, back in the calling macro, I’m referencing that variable ( %Variable%futureDate%) in the "insert text by pasting’, and it seems to be working.

I’ve removed the clipboard steps and all is still good.


Here is an example executing a sub-macro, passing in a parameter and getting a returned result in a variable.

It uses Local variables (which are local to the respective macros), and uses an Instance variable to return the result which is then displayed.

Submacros and Other Macros.kmmacros (3.6 KB)

Thank you! :slight_smile: