From VB6 how to determine if an Excel cell string containssuperscript?

G

gdu

I am reading contents of an Excel file from a VB6 program. How do I
know if a string from a cell contains superscript or different fonts
(such as Greek letters)? Thanks.
 
J

Jim Cone

Superscript and Name are properties of the cell font.
Superscript returns True or False and Name returns the Font Name...
MsgBox Range("B6").Font.Superscript & vbCr & Range("B6").Font.Name

Note: "Name" has various uses in Excel. It can be an object or a string.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



<[email protected]>
wrote in message
I am reading contents of an Excel file from a VB6 program. How do I
know if a string from a cell contains superscript or different fonts
(such as Greek letters)? Thanks.
 
J

Jon Peltier

In general, the entire contents of a cell would not be super/subscripted,
and it's likely other formatting may be applied on individual characters. In
such case, you need to test each character:

?activesheet.range("B1").Characters(2,1).font.superscript

- Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top