‎2007 Jun 16 3:54 PM
Hi,
I'm currently opening an Excel document stored within BDS and am trying to populate certain fields before running a macro.
When I was previously using OLE objects to do this, I managed to do this as well as run the macro which was responsible to print a relevant sheet in Excel.
However, as I'm now required to read the document from BDS, I'm using the I_OI_DOCUMENT_PROXY class to run the Excel macro. I've tried using the EXECUTE_MACRO method but I keep getting the error 'MACRO_OR_SCRIPT_FAILED'. Does anyone know what's the cause of this and how do I go about solving this?
Appreciate your help!
Thanks and regards,
Adeline.
‎2007 Jun 20 8:48 AM
Hi,
I finally managed to figure this out. As the macro was created within a module, when calling the EXECUTE_MACRO method, the module name would have to be specified first, followed by the actual macro name. Below is an example.
data: doc TYPE REF TO i_oi_document_proxy.
CALL METHOD doc->execute_macro
EXPORTING
macro_string = 'ModPrint.PrintCard'.
where ModPrint is the module and PrintCard is the macro.
Thanks and regards,
Adeline.