How Can I Get or Set the Font of a Cell In Xcel?

I see several items in the dictionary but can’t figure out how to implement.


tell application "Microsoft Excel"
	
	-- get the cell contents:
	get value of cell "C5" -- this works.
	
	get font of value of cell "C5" -- returns missing value
	
	get font name of value of cell "C5" -- returns missing value
	
	get font of font object of cell "C5" -- returns missing value
	
	get font of cell "C5" -- returns missing value

end tell

Thank you!
ICTA


tell application "Microsoft Excel"
	get name of font object of cell "C5"
end tell

Thank you StefanK,

Please also tell me how to set the font. It’s just not obvious :(. None of these work:


tell application "Microsoft Excel"
	
	set font of font object of cell "C5" to "Verdana" -- does not work
	
	set font name of font object of cell "C5" to "Verdana" -- does not work
	
	set font object of cell "C5" to "Verdana" -- does not work
	
	set font of cell "C5" to "Verdana" -- does not work
	
end tell

Thank you!
ICTA

Model: 2.66 GHz Dual-Core Intel Xeon G5
AppleScript: 1.10.7
Browser: Safari 525.13
Operating System: Mac OS X (10.4)

it is obvious :wink:

tell application "Microsoft Excel"
   set name of font object of cell "C5" to "Verdana"
end tell

You’re right! It is obvious.

That was the first thing I tried.

It also helps if you correctly identify the cell you are trying to change.

Thanks again!

ICTA