Here’s an AppleScript which will toggle the position between left and right:
tell application "System Events" to tell dock preferences
if screen edge is right then
set screen edge to left
else if screen edge is left then
set screen edge to right
end if
end tell
I use the keyboard shortcut ⌥ D (because ⌘⌥ D is “Show/Hide Dock”) in Keyboard Maestro (c’mon, why don’t you own this app yet?!)
With Keyboard Maestro you could either move it to the right when Excel launches and move it back when Excel quits, or you could just move it when Excel is the front-most app and move it back when it is not.
Or just trigger it manually.
Keyboard Maestro Trial and Discount
Source: https://learnomnifocus.com/app/keyboard-maestro/
Stairways Software , the creators of Keyboard Maestro, have kindly offered a 20% discount to everyone in the Learn OmniFocus community. Enter the coupon code LOF20 when purchasing Keyboard Maestro to apply the discount. You can also download and test drive Keyboard Maestro before purchasing.
My biggest regret of my “Mac Life” is not getting started with Keyboard Maestro sooner.
It has a 30 day trial. Download and use it for 30 days and you’ll happily pay for it.
Also, the two best forums on the Mac web are MPU and http://forum.keyboardmaestro.com