I am trying to write a script that will trigger an Excel macro. This should be easy but for some reason I can not get it to work. For simplicities sake I wrote the following script to trigger a macro that creates a chart based on two columns of data with in the file Trigraphdata.xls.
tell application “Microsoft Excel”
Activate
Evaluate “Trigraphdata.xls!WeightChart()”
end tell
When I run this excel activates but then nothing happens. I know the marco works when I trigger it from the menu in Ecxel. Am I missing something??
I’m assuming you’re using Excel X with Service Release 1 installed?
I run macros the same way you suggested without difficulty. I’ve seen trouble when users have macro virus protection turned on and choose to disable macros when they open a document. That’s not your problem since this macro runs fine from the menu.
Is the document already open when you run your script?
Does specifying an explicit path to the document help?
Is there ANY chance that you have a typo in the document name or Macro name?
If you wrap you call in a try/on error, do you get anything back from Excel?
Since I can’t reproduce your problem, I’m just guessing.
I tried taking out the .xls and I had the same result…nothing. It seems as though I am doing this correctly but it still does not work. I am baffled. I made a script by using the record button and the same script resulted as the one I wrote so now I am really confused as that one did not work either.