Before looking at scripting details and whether OnObjectMOdify is the best script trigger to use here, let's make sure that I understand what you want to be done with that excel file.
1) YOu want to copy an existing file
2) you want the new copy opened so that users can add/edit data in this file.
3) the reference to this modified copy is then to be stored in the container field?
Will the original copy of the file be left unchanged?
Happy to clarify.
1. Yes, an existing file should be put in and left unchanged.
2. Yes, I want the new copy opened so the users can add/edit data.
3. Yes, the reference to the new, modified copy (and it's save location) should be stored in the container field.
Thanks so much!
A script can do this.
Use a container field to store a reference to the original file. Use a second container field--possibly in a different record or even a different table--to store the reference to the new copy.
Export Field Contents can create a copy of the original file and export it to the "save" location where you want the file to be saved. An option on this script step can cause the exported copy to open automatically so that the user can modify it.
This newly created copy can then be inserted with a store by reference option to store the location of this new copy.
The one thing that this does NOT allow, is the option for the user to decide where to save the new copy as the script sets that up for the user. If the user uses "Save as.." from the Excel file, there's no simple way for FileMaker to be able to determine the location of such a new copy of the file.