0 Replies Latest reply on Sep 26, 2012 4:03 AM by CliveScott

    send event not working

    CliveScott

      Summary

      send event not working

      Product

      FileMaker Pro

      Version

      12

      Operating system version

      XP SP3

      Description of the issue

      Filemaker sometimes doesn't open MSWord  documents correctly. We have some code which works on our system but not on the clients site. The issue revolves around 'send event'- using this to open a word document template. Containers are not being used on the client site - though in the past they have been used on our system. At the moment I'm guessing that this may have altered the registry in such a way as to allow things to work.

      Steps to reproduce the problem

      Set Variable [ $vf; Value:"filewin:G:\filemaker\Test.dotx" ]
      Set Variable [ $$signature; Value:"Test worked!" ]
      Set Error Capture [ On ]
      #
      #This should cause Test.dotx to open in Word
      # The following line fails to open Word. But if Word is already open it works.
      #
      Send Event [ open document/application; File Name: “$vf” ] [ Bring application to foreground ]
      Set Variable [ $i; Value:0 ]
      Loop
           Pause/Resume Script [ Duration (seconds): 1 ]
           Set Variable [ $i; Value:$i + 1 ]
           #
           # This line gives an error because Word is not open.
           #Run-time error ‘509’:
           #The EditReplace command is not available because a document window is not active
           #
           Send DDE Execute [ Service Name: "WinWord"; Topic: "system"; Commands: "[EditReplace.Find=\"<>\",.Replace=\"" & $$Signature & "\",.ReplaceAll,.Wrap=1]" ]
           Set Variable [ $junk; Value:Get ( LastError ) ]
           Exit Loop If [ $junk ? 3 ]
           If [ $i > 9 ]
           Exit Script [ ]
           End If
      End Loop
      Set Error Capture [ Off ]
      Pause/Resume Script [ Indefinitely ]
      --------------------
      Test.dotx contains one line reading:

      This is a test <>
      ---------------------

      Expected result

      Word should open with a document containing:

      This is a test Test worked!
      ------------------

      Actual result

      Run-time error ‘509’:
      The EditReplace command is not available because a document window is not active


      Don’t get too hung up on ‘EditReplace’. I’m fairly sure it could be some other command - it just happens to be ‘EditReplace’ which it is trying to run at the time.

      Their version of word is 12.0.6661.5000 SP3 MSO 12.0.6662.5000
      Our   version is 12.0.6661.5000 SP3 MSO 12.0.6607.1000

      Neither turning off the firewall or MS security essentials made any difference.
      -----------------
      If Word is already open it works fine - so its going from  the .dotx extension to causing word to open which is the problem. Double clicking on the template causes it to open normally. So there must be a difference between double clicking and sending an open event to the file.

      Exact text of any error message(s) that appear

      Run-time error ‘509’:
      The EditReplace command is not available because a document window is not active

      Configuration information

      Their version of word is 12.0.6661.5000 SP3 MSO 12.0.6662.5000
      Our   version is 12.0.6661.5000 SP3 MSO 12.0.6607.1000

      Workaround

      Keep a copy of word open all the time.