I have created an XCODE project, that sends data to Excel from an app on 1 mac to Excel on another mac… It works fine from a mac that has Excel loaded on it, but it will not run a mac that it isn’t loaded on. It asks me to locate Excel… I can’t figure out how to fix this. Here is the part of the script that is telling it to use Excel on the mac it is loaded on (BaseMac)
try
tell application “Excel” of machine BaseMac
using terms from application “Microsoft Excel”
Activate
tell Worksheet 1
set CurrentCell to ((“R1” as string) & ExcelRange2) as string
It’s also a typo
Sending Remote Apple Events is a bit tricky.
You can’t open applications directly, you must open them by the application file id (which is actually the bundle identifier)
tell application "Finder" of machine BaseMac
using terms from application "Finder"
if "Microsoft Excel" is not in (get name of processes) then open application file id "com.microsoft.Excel"
repeat until "Microsoft Excel" is in (get name of every process)
delay 1
end repeat
end using terms from
end tell
try
using terms from application "Microsoft Excel"
tell application "Microsoft Excel" of machine BaseMac
activate
tell worksheet 1
set CurrentCell to (("R1" as string) & ExcelRange2) as string
end tell
.
Note: You have to use the Finder to open the application, because it runs reliably, System Events doesn’t
Thank you, I had to change 2 line of the code to get it to build without error:
swapped the lines around
tell application “Microsoft Excel” of machine BaseMac
using terms from application “Microsoft Excel”
However, I still have the same problem. The little app that this code is associated with, will launch fine on another mac, but when
I go to send the data to the receiving mac with Excel on it, it still asks me to locate my copy of Excel…
It appears that the only solution is to load Excel on all the machines that are to use this program, for the ones that do have Excel on them the app works fine.