How to activate the pdf button on the print screen.

Hello, I am new to apple scripting and apologize up front if this is a stupid question. I am able to control the “Print”, “Print Preview”, “Cancel” buttons. If I could find the little black down arrow I should be able to control the “PDF” button. I have searched every for 5 hours and cannot find any form of help.

tell application “Microsoft Excel” to Activate

tell application “System Events”
tell application process “Microsoft Excel”
click menu item “Print…” of menu “File” of menu bar item “File” of menu bar 1
– omitting ‘of application process “”’
end tell

tell application "System Events"
	tell application process "Microsoft Excel"
		click button "PDF" of window "Print"
	end tell
end tell

end tell

I would appreciate any input anyone can provide.


welcome to MacScripter.

Take a look at