RobBroekhuis
Technical User
The recent post on applying superscript formatting reminded me of a problem I've encountered (on a few occasions, actually - sometimes I forget my own learnings
) with setting super- and sub-scripts programmatically, in any kind of characters object (cell contents, axis titles, etc). My code was something like this:
For j = 1 To Len(Attl)
With Attl.Characters(j, 1).Font
.Subscript = IsSub(j)
.Superscript = IsSuper(j)
End With
Next j
where IsSub and IsSuper are boolean arrays that I had predefined. Problem was, the subscripts never worked. It took me a while to figure out that assigning any value (even false) to the .superscript property undid the value of the subscript property. So I rewrote my code:
For j = 1 To Len(Attl)
With Attl.Characters(j, 1).Font
If IsSub(j) then .Subscript = True Else _
If IsSuper(j) Then .Superscript = True
End With
Next j
Seems simple, but it took me some banging head against wall to understand....
Rob
![[flowerface] [flowerface] [flowerface]](/data/assets/smilies/flowerface.gif)
For j = 1 To Len(Attl)
With Attl.Characters(j, 1).Font
.Subscript = IsSub(j)
.Superscript = IsSuper(j)
End With
Next j
where IsSub and IsSuper are boolean arrays that I had predefined. Problem was, the subscripts never worked. It took me a while to figure out that assigning any value (even false) to the .superscript property undid the value of the subscript property. So I rewrote my code:
For j = 1 To Len(Attl)
With Attl.Characters(j, 1).Font
If IsSub(j) then .Subscript = True Else _
If IsSuper(j) Then .Superscript = True
End With
Next j
Seems simple, but it took me some banging head against wall to understand....
Rob
![[flowerface] [flowerface] [flowerface]](/data/assets/smilies/flowerface.gif)