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

    Transfer data from a worksheet to a Flex embedded application

    Rico ledaouf
      Hi,

      I would like to transfer data from an Office 2003 worksheet to a Flex application located on the same worksheet (ie Flash activeX inserted). To pass these data, I use the ExternalInterface API in the Flex framework.
      All works fine if the Flex file (a SWF in fact) is not embedded into the Excel file. When I decided to embedd the Flex application into Excel, I met the folowing error:

      SecurityError: Error #2060: Security sandbox violation: ExternalInterface caller file:///C|/Program%20Files/Microsoft%
      20Office/OFFICE11/EXCEL.EXE cannot access <unknown>.
      at flash.external::ExternalInterface$/_initJS()
      at flash.external::ExternalInterface$/call()
      at DisplayContainerData/GetExcelData()[E:\DisplayContainerData\src\DisplayContainerData.mxml :22]
      at DisplayContainerData/___DisplayContainerData_Button1_click()[E:\DisplayContainerData\src\ DisplayContainerData.mxml:246]

      I tried to play with activeX properties (allowScriptAccess and AllowNetworking) without success. How can I fix this error?


      In the other hand, I must call Flex method in VBA code. I tried to use the CallFunction method of the Excel Shockwave activeX object, but it always fails. Here is the used syntax in my VBA code (the 'test' function exists in Flex code and is registered with the ExternalInterface.addCallback method):
      Call ShockwaveFlash1.CallFunction("<invoke name=""test"" returntype=""xml""/> <arguments> <string>Hello World!</string> </arguments> </invoke>")
      The reported error is:
      "Run-time error '-2147467259 (80004005)': Method 'CallFunction' of object IShockwaveFlash' failed"
      I have tried the same call with a dotNet application and it succeeded. How can I call a Flex function in Excel VBA code ?


      Thanks.