Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

handling super/subscripts programmatically

Status
Not open for further replies.

RobBroekhuis

Technical User
Oct 15, 2001
1,971
US
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]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top