dlh
03-10-2009, 05:07 PM
I'm trying to automate some fancy formatting and I'm looking for character-based style functionality in Excel (rather than cell-based).
Both of the following statements don't work ("subscript out of range" errors). Can anyone explain why?
Set MyCell.Characters(1, 5).Font = ThisWorkbook.Styles("MyStyle").Font
Set MyCell.Font = ThisWorkbook.Styles("MyStyle").Font
I know I can manually define each individual Font object member within a Characters object:
MyCell.Characters(1, 5).Font.Italic = True
MyCell.Characters(1, 5).Font.Name = "Courier"
MyCell.Characters(1, 5).Font.Size = 11
'etc. etc.
But is there anything more elegant and concise?
Both of the following statements don't work ("subscript out of range" errors). Can anyone explain why?
Set MyCell.Characters(1, 5).Font = ThisWorkbook.Styles("MyStyle").Font
Set MyCell.Font = ThisWorkbook.Styles("MyStyle").Font
I know I can manually define each individual Font object member within a Characters object:
MyCell.Characters(1, 5).Font.Italic = True
MyCell.Characters(1, 5).Font.Name = "Courier"
MyCell.Characters(1, 5).Font.Size = 11
'etc. etc.
But is there anything more elegant and concise?