I want to change Western and Asian font settings of selected text in a PowerPoint (2011 Mac) slide with AppleScript. Something like the following should work, according to this. However, I can't even get text range of selection, let alone name of font.
tell application "Microsoft PowerPoint"
tell active window
set name of font of text range of selection to "Palatino"
set east asian name of font of text range of selection to "YuMincho"
end tell
end tell
Here is the result.
error "Can’t get text range of selection." number -1728 from «class TObj» of «class SelO»
In effect, the following issues the same error.
tell application "Microsoft PowerPoint"
tell active window
get text range of selection
end tell
end tell
On the other hand the following simple VBA code works fine.
Sub HiraginoSansW2HelveticaNeueLight()
With ActiveWindow.Selection.TextRange.Font
.Name = "Palatino"
.NameFarEast = "YuMincho"
End With
End Sub
Essentially, the VBA does what I want, but it involves enabling Macro and saving in .pptm format rather than standard .pptx, etc. It's not as handy as AppleScript, which I can access from menu bar.
Could anyone help me get the AppleScrit work?