How to Run a AppleScript from VBA using AppleScriptTask

Scottxt

New Member
Joined
Dec 20, 2023
Messages
2
Office Version
  1. 365
Platform
  1. MacOS
Newbie here...discovering AppleScript and after following many examples to thankfully have them work perfectly by being called from an Excel VBA module, I'm simply baffled on how to accomplish a "custom" simple task of executing a script from VBA. My goal is to have VBA code run a script to then select a validation cell and show the drop down list items. Simple right? Well this neanderthal can't make it happen. Must be missing something so basic and right in my face that will have everyone laughing at me. I'm ready for the ridicule. Here is my basic code:
VBA:
Sub Test()
Dim RunMyScript As Boolean
Dim FilePathName As String
FilePathName = "/Users/scott/Library/Application Scripts/com.microsoft.Excel/Validation Drop Down Arrow Script.scpt"
RunMyScript = AppleScriptTask("Validation Drop Down Arrow Script.scpt", "ArrowDown", FilePathName)
End Sub
_______
Script:
on ArrowDown()
tell application "Microsoft Excel"
activate
delay 0.1
select range "G2"
tell application "System Events" to key code 125 using option down
end tell
end ArrowDown

*Note: The script works fine when run from script editor but fails endlessly no matter how I try to call it from VBA. Very frustrating and has up my beer intake this week.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: https://stackoverflow.com/questions/77699377/how-to-run-a-applescript-from-vba-using-applescripttask
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,263
Members
452,627
Latest member
KitkatToby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top