I have tried to work out how to maximize Excel (2011) when its minimized . I have managed to get it to work by toggling full screen commands twice but that is very clumsy and wondered if anyone had a better idea. This is my code. Thanks
--Restores Excel from Minimised State
--Key Code is "Command" "Control" "F"
--The repeat block is necessary as the 1st calls it to full screen
tell application "Microsoft Excel"
activate
tell application "System Events"
tell process "MICROSOFT EXCEL"
key code {59, 55, 3}
end tell
end tell
end tell
delay 3
tell application "Microsoft Excel"
activate
tell application "System Events"
tell process "MICROSOFT EXCEL"
key code {59, 55, 3}
end tell
end tell
end tell
tell application "Microsoft Excel" to set window state of window 1 to window state maximized
More stable variant:
tell application "Microsoft Excel"
activate
repeat until (exists window 1)
delay 0.1
end repeat
set window state of window 1 to window state maximized
end tell
NOTE: In both cases, it is assumed that you already have open some kind of Excel worksheet.
To minimize the excel window (to send to dock):
tell application "Microsoft Excel"
activate
repeat until (exists window 1)
delay 0.1
end repeat
set window state of window 1 to window state minimized
end tell
To close the window completely (to close worksheet):
tell application "Microsoft Excel"
activate
repeat until (exists window 1)
delay 0.1
end repeat
close window 1
end tell
Setting Excel to “Display full screen” state (hiding toolbar and others):
tell application "Microsoft Excel"
activate
set display full screen to true
end tell
Sorry for the delay in acknowledging your help, that worked thanks very much