If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Chemical Legend
Dear bunch of (lower level) chemists,
Inspired by dear Bernard Liengme in this NG (http://www.microsoft.com/communities...0-a3d352859e6d) I have accomplished his hints into an elaborated subroutine. I think it’s been rewarding, at least Microsoft should acknowledge. The result follows. I’m happy to share it with you; though many of yours have undoubtedly succeeded in making the analogue. For many others it may save time. In any case, it should help to lift the standard of our presentations. In spite of the fact that we are admonished from many people to avoid Excel in technical applications at all. But Excel is so simple and everybody has it. Still, did anybody offered so much effort to find out another "chemistry" font with better types? ChemFont97, as here applied, looks rather amateurish (moreover "the developer passed away"), especially as you inspect its normal size. Regards Petr Sub ChemistryLegend() ' Petr Bezucha, 2007 ' Sub converts a text (chemical formula) contained in a ' selected cell, which was regularly written in the basic font ' with all appropriate numerals as subscripts or superscripts, ' into the "chemistry" font, with built-in sub- ' or superscript characters. ' In this way the converted text can be referenced in ' - a chart legend, ' - an arbitrary cell, ' without loosing its conventional, legible form. ' The target destination item (legend, cell) must be, of ' course, formatted in the same or akin font. Such twins used ' here are True Type Fonts: ' "Chemistry SansSerif" and "Chemistry Serif", ' http://www.scs-intl.com/frameload.htm?/chemfont.htm ' which were made to approach Arial and Times New Roman types. ' Sub proceeds from the proposal of Prof Bernard Liengme. ' Sub does not check whether the selected font has been installed. ' First of code numbers of super- and subscript ranks in ' "chemistry" True Type Fonts: Const SuperBegin As Long = 128, SubBegin As Long = 144 Dim T As Variant, I As Long, Cha As Characters, TFontName _ As String, ChFontName As String Set T = Selection 'Selection between the "chemistry" fonts according to the 'original font: TFontName = T.Cells.Font.Name If Left(TFontName, 5) = "Arial" Then ChFontName = "Chemistry SansSerif" Else ChFontName = "Chemistry Serif" End If 'Conversion of numerals codes into the later "chemistry" ones: For I = 1 To Len(T) Set Cha = T.Cells.Characters(I, 1) If IsNumeric(Cha.Caption) Then If Cha.Font.Superscript = True Then Cha.Text = Chr(CInt(Cha.Caption) + SuperBegin) End If If Cha.Font.Subscript = True Then Cha.Text = Chr(CInt(Cha.Caption) + SubBegin) End If End If Next I 'Removal of all sub- and superscripts and conversion into the '"chemistry" font: With T.Cells.Font .Subscript = False .Superscript = False .Name = ChFontName End With End Sub -- Petr Bezucha |
#2
|
|||
|
|||
Chemical Legend
PBezucha wrote on Tue, 24 Jul 2007 23:24:01 -0700:
P Still, did anybody offered so much effort to find out P another "chemistry" font with better types? ChemFont97, as P here applied, looks rather amateurish (moreover "the P developer passed away"), especially as you inspect its P normal size. I have used the Chemistry fonts (Serif and san-serif) from http://www.freeware-guide.com/dir/ho...chemistry.html for some time. I wrote (truthfully, my son developed my attempts into practicality :-) a macro and use it a lot that converts a formula written in normal letters like C2H5OH to put the numbers in subscripts. I'll admit the VBA code looks interesting and more versatile. The Royal Society of Chemistry also provides a free downloadable font:- http://www.chemsoc.org/networks/learnnet/RSCfont.htm James Silverton Potomac, Maryland E-mail, with obvious alterations: not.jim.silverton.at.verizon.not |
#3
|
|||
|
|||
Chemical Legend
"James Silverton" wrote: I have used the Chemistry fonts (Serif and san-serif) from http://www.freeware-guide.com/dir/ho...chemistry.html for some time. I wrote (truthfully, my son developed my attempts into practicality :-) a macro and use it a lot that converts a formula written in normal letters like C2H5OH to put the numbers in subscripts. I'll admit the VBA code looks interesting and more versatile. The Royal Society of Chemistry also provides a free downloadable font:- http://www.chemsoc.org/networks/learnnet/RSCfont.htm James Silverton Potomac, Maryland E-mail, with obvious alterations: not.jim.silverton.at.verizon.not Dear James, Thanks for the notices. I tried both fonts but to no avail. Incredibly chaotic. Royal has subsripts but not ordered, and from this reason useless for macros. 1LanzChemistry is (today already impractical) for structures, the worse. Golden ChemistrySerifs. I have elaborated some macro for converting formulas, too. It is rather comfortable, takes respect to multiples (NaI×2H2O) and charges (Fe3+). Modified similarly for using in Word. Strongly accelerates work with sizable tables (or strongly cultivates usually neglected presentation). Now can be linked with actual ChemicalLegend, so that you need not bother with embroidering subscripts at all. Kind regards to you and your promissing son -- Petr |
Thread Tools | |
Display Modes | |
|
|