Results 1 to 3 of 3

Thread: Desktop Pro - RunMacro from MS Excel receiving compile error

Threaded View

  1. #1
    Join Date
    Jul 2017

    Desktop Pro - RunMacro from MS Excel receiving compile error

    Hello. I am coding for my work, using Reflection Desktop 16 and MS Excel v15. I am trying to invoke a macro on Reflection from Excel. When I use the RunMacro method, I get the 'Expected Function or Variable' compile error.

    The function called returns a user-defined class and when I run it from Reflection VBA it returns the class nicely, so that isn't the problem. It is a possibility that I don't have the class set up correctly yet on Excel but I am feeling that I'm not coding the arguments correctly to call the function. I am using Early Binding and Intellisense is giving me the macro parameters so it is seeing the terminal object at least. I tried coding this off the example from 'Running Reflection Macros from Excel or Another Application' in your Key Concepts, but that is using RunMacro2 and calling a subroutine and I need to pass a paramter (paramarrays make me want to jump out of a window so I'm desperately hoping to avoid RunMacro3.)

    I could use a little guidance, please.

    Command line (I have tried both of these with the same result):

    Set objMyObject = termRefl.Macro.RunMacro(MacroEnumerationOption_Doc ument, "ThisIbmTerminal.HelpExcel", "(input string)")
    Set objMyObject = termRefl.Macro.RunMacro(MacroEnumerationOption_Doc ument, strMac, strInput) (wrapped the strings)

    Macro in Reflection --> Public Function HelpExcel(strA As String) As MyObject
    (This procedure actually calls another Reflection function because it has to do a little manipulation to that string first, because paramarrays. I think the second function would throw the error in Reflection, not Excel, though.)

    My project in the Project Window Looks like this:

    MacroContainer (MacroScreen)
    -> Modules

    I have tried qualifying the MacroName in the following manners:

    ThisIbmTerminal.MacroContainer.Modules.ExcelSuppor tMacros.HelpExcel
    MacroContainer.Modules.ExcelSupportMacros.HelpExce l

    (Edit: the space in Document is being added by this form, it is spelled correctly in my code.)
    Last edited by JoeyB; 07-Jul-2017 at 12:11 AM. Reason: Typo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts