HI,
I’m struggling to set up part of an Applescript to open up an Excel file, as I need to override the “Enable Macros” dialog, but I can’t get it to work. Any ideas ?
My script looks like this:
on adding folder items to this_folder after receiving added_items
try
tell application “Microsoft Excel”
activate
try
open added_items as alias without dialog
–open added_items as alias with option “Enable Macros” True
on error errTxt
return errTxt
end try
end tell
return input
end try
end adding folder items to
Sorted !
Applescript should be :
on adding folder items to this_folder after receiving added_items
tell application "Finder"
set myFile to displayed name of item 1 of folder "xxxxx" of desktop
end tell
try
tell application "Microsoft Excel"
activate
try
open workbook workbook file name myFile
run auto macros active workbook which auto open
on error errTxt
return errTxt
end try
end tell
return input
end try
end adding folder items to
Actually the sorted suggestion did not work for me.
What finally worked was:
activate application “Microsoft Excel”
tell application “System Events”
tell process “Microsoft Excel”
set foo to open “/tmp/tst.xls”
set macros to button “Enable Macros” of window 1
click macros
end tell
end tell
I got the proper incantation ‘button “Enable Macros” of window 1’ using UIBrowser from pfiddlesoft.com.