0 Replies Latest reply on Apr 7, 2008 7:20 AM by Rico ledaouf

    Flex and Excel interaction

    Rico ledaouf
      Hi,

      I would like to embed a Flex 3 application on an Excel 2003 worksheet. The Flex application must be able to communicate with Excel VBA code (to transmit or receive data for example).
      The only way yet found to interact is to use the ExternalInterface.call() method in Flex application. Arguments can be passed, althought the call is transmitted under XML string form into Excel VBA code (string must be parsed manually in VBA code). A value is returned to Flex application using the SetReturnValue method of the ShockwaveFlash object. The returned value is of string type, even if we specify an other type in response message. 1) As the return value from the ExternalInterface.call() method is of 'object' type, is it possible to get the return value according to its specified type in Flex application?

      The ExternalInterface is a bi-directional API, so it is theoretically possible to send command to Flex application from Excel VBA. I've tried many argument syntax (based on XML, like "Call ShockwaveFlash1.CallFunction("<invoke name=""aFlexMethod"" returntype=""xml""/>")") without any success.
      2) How can I call Flex methods from Excel VBA code?

      An other problem with the ExternalInterface use, is that, when the Flex application is set to 'embedded' to Excel, a security sandbox violation error is thrown:
      SecurityError: Error #2060: Security sandbox violation: ExternalInterface caller file:///C|/Program%20Files/Microsoft%20Office/OFFICE11/EXCEL.EXE cannot access <unknown>.
      I tried to change some properties (allowDomain, allowInsecureDomain, allowScriptAccess, allowNetworking) without any results.
      3) How can I get rid of this error?

      The ShockwaveFlash object has GetVariable() / SetVariable() and TGetProperty() / TSetProperty() methods. All I know is that the GetVariable with "/" argument returns "_level0" and all the other returns 'method call failed' or a 'Type mismatch' error.
      4) How can I use these methods to get/set Flex existing public variables or to customize displayed components?

      5) Are there some other methods / properties that allow Flex / Excel communication (passing an Excel worksheet data into an array argument to Flex application for example)?

      Thanks in advance.
      Rico