ࡱ> } sIH    !"#$%&'()*+,-./0123456789:;=G?@ABCDEF<kJKlMWOPQRSTUVLXYZ[\]^_`abcdefghijzmnopqrtxvwy{Root Entry F` } AE~5WorkbookXCBQ_VBA_PROJECT_CUR"1C~ AE~  !"#$%&'(*+-./0123456789:;<=>@ABDFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|} ChemFormat2Le2Le2Le(Chemistry FormatterChemistry Formatter applies sub- and superscripts converts * to " ; makes arrows elegant converts 1E5 to exponential notationChemFormatCKTSUstorageChemicalFormat( p(<<<<< ɀ\p stacy parker Ba= ThisWorkbook=h%<X@"1Arial1Arial1Arial1Arial"$"#,##0_);\("$"#,##0\)!"$"#,##0_);[Red]\("$"#,##0\)""$"#,##0.00_);\("$"#,##0.00\)'""$"#,##0.00_);[Red]\("$"#,##0.00\)7*2_("$"* #,##0_);_("$"* \(#,##0\);_("$"* "-"_);_(@_).))_(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@_)?,:_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)6+1_(* #,##0.00_);_(* \(#,##0.00\);_(* "-"??_);_(@_) 0.0000                + ) , *  `Sheet1`i ɀ d  dMbP?_*+%"??U>@7 Sheet1 rU X$`$A` $`$nLz40#<̍FG$ F̍FG$x̍FG$̍FG$MEVBA1C~XD~ThisWorkbook b__SRP_8>__SRP_9 ) ?$*\Rffff*353fa91dcd$*\Rffff*343fa91dcd*\R3*#92*\R1*#b8*\R3*#51$*\Rffff*383fa91dcd*\R0*#19*\R0*#13*\R3*#2f*\R3*#8c*\R0*#14*\R0*#1*\R0*#e*\R0*#f*\R1*#c4*\R1*#229*\R3*#51*\R3*#4d*\R1*#b3*\R3*#30*\R3*#52*\R3*#50*\R3*#4f*\R3*#4e*\R1*#181L$ F HP L H 0 H h L , D LP D B 0 P  h z zp F 8 X 8@H *P$(@NI46#T̍FG$F̍FG$x̍FG$̍FG$ME( ph`@[LSS ,"(LdN(LJ(LlF(L@(2Xl%`BV f th DPP08h% HLPd% L8Hp`% ` \kEE +xment %`t@r`8l8`:h`<d ?xhp %%x% `,k"4(@b8@ H @PB 0<@b$D@0x Xh @ 8@P@ @0 @  @8 ,@8 <@ @  \@ *@ O  @@ P@ p@ x@ @8 p@P @h @@ `@ @ (@ `@ @ @ @( X@@ h@X| @px @t @p @l x@h @d @ ` @ \ @0 X @` T hjdn "$@x P rent@ L X@ H rmat@ D V@@ @ 0 0@ 0 +$X ` Excp  00!^H &zinal@  add X @ffers@ O in i @instal@ a@h @ / L/An a@O to ( Pond co [/of@P tter@ :@ !@ stor@ @ @ to l8  @ X XR "$y @ ` aded@( \ run@ L stal@ < $ @ , Work@ @ ns(Th p`ocum @ ies(1)  `' Dol% h  mark @  ist.@  `8@  0@P @h eve &nfof8`\% 2n!@ ndex@ Parejdp'"@ $@ &@ loca@ '4@ ':@( ate @@ the@X dele@p @ ar.@ -@ n to@ @  T@ ena@ 4@0  @H nt c@` ing @x pen @ eted@ !@ @@| (@l @\ enu.PXR @t ol i@Pp larg@` @ P @8@ @0 U@, % CPxxpX " : (08@HP X  ` Dp D  D &X DL    !    .9 8 8H 8  Pc 2 *            4  0>87X8x>>        D(`6*   &$Z Z8 V      J ( 8 #H $` , 2(   (8@  H ,`  <  \  Lx *2b 0 @H Php  Bx .*J 0]p : BC( ;@X"`Dz*> $'( B@ ` =h2  8 : 0  P X` "h x   HCx" H F D` F . F  Hh H &    8( `p  xDL    &0 *8hp x   4 "   *  P X`h D>p 0  .8 1  1@  2`  1  h1  !!! !(!0! 8!HC@! 4#@# "H#P# >X#6L# #8#$  F$'P$  h$ x$$?@ This workbook contains the procedures to install and remove theCA chemistry formatter button on the tool bar, and to start and endE the class module that controls whether or not the button is enabled.A The workbook contains a "storage toolbar", that holds the button to be added.8 How to add the toolbar:` 1) Create the toolbar.E 2) Attach it to the add-in file (from the toolbar customize menu).% 3) Save and close the add-in file.= 4) A copy of the toolbar was created, and must be removed.,@F Delete the toolbar from Excel (from the toolbar customize menu).> The position of the button is stored in "DocumentProperties".; These properties were initially added to the workbook with the following statements.ThisWorkbook.CustomDocumentProperties.Add Type:=msoPropertyTypeString, Name:="ToolbarName", Value:="Formatting", LinkToContent:=False}ThisWorkbook.CustomDocumentProperties.Add Type:=msoPropertyTypeString, Name:="ControlIndex", Value:="9", LinkToContent:=False{ThisWorkbook.CustomDocumentProperties.Add Type:=msoPropertyTypeNumber, Name:="ParentType", Value:="0", LinkToContent:=FalsesThisWorkbook.CustomDocumentProperties.Add Type:=msoPropertyTypeString, Name:="Tag", Value:="", LinkToContent:=False\tThisWorkbook.CustomDocumentProperties.Add Type:=msoPropertyTypeString, Name:="Name", Value:="", LinkToContent:=False?ThisWorkbook.Save ' They aren't accessible until it is saved. For setting the tooltip:commandbars("ChemFormat").controls(1).tooltiptext="Chemistry Formatter" & vbcr & " applies sub- and superscripts" & vbcr & " converts * to ; makes arrows elegant" & vbcr & " converts 1E5 to exponential notation"\]$ Initial location of toolbar button.]@]@]@0]@]@4 Adds a "Chemistry Formatter" button to the toolbar.DAF] ]8]P]h]]]]]]]]8]XP Clean up.> If the button is already present, delete it. (This cleans up if the user created a duplicate, or, perhaps, if the computer  crashed.)= This doesn't find the button in the storage toolbar; that button has a different tag.D XlZChemFormatCKTSU\ R!T%V.* * !^'. 0 ` 0!b 0!$Chem Formatter Excel 0!^ .1 An installed "Chem Formatter" addin that differs1 from this addin is already installed. Exit with a message.$ !%/3=/An attempt is being made to load a second copy f/of the Chemistry Formatter. The first copy is: f  0!, f stored in f  0!h f fThe add-in trying to load is: f  !, f stored in f  !h f f8To prevent problems, one of the above should be removed. j"Chemistry Formatter Already LoadedA@d, Don't run the rest of this install routine.$ ThisWorkbook.Close AddIns(ThisWorkbook.BuiltinDocumentProperties(1)).Installed = False ' Doesn't work. Check mark remains in add-ins list.|Hk@k8k0 0 *B@lk. Retrieve the previous location of the button.  ToolbarName7n!p' ControlIndex7n!p'  ParentType7n!p'"Tag7n!p'$Name7n!p'&q0 Make local copies. '4 '6 "'8 $': &'<> Validate the position in case the parent control was deleted. 8 Parent is a toolbar. > R!T- Find the destination toolbar. >! 4 >!r Toolbar exists and is enabled.'B 6 4 R%T!t!v T Prevent control index from being too large (could happen if controls were deleted). 4 R%T!t!v '6k@k8y0k( >d Parent is a popup menu. z 8 : R!T%x.D D H D H!@! < The parent popup menu exists. H.L'B 6 L!t!v , Prevent control index from being too large. L!t!v '6kyk Hkk Use defaults% Can get here if user deleted button. B6 Place the button after the "Merge & Center" button on the "Formatting" toolbar.'8 Formatting'4 a45gidm40d' C Forces addin to be saved even if button is deleted twice in a row. E (The "undo" info in sheet1 wasn't being cleared if this is omitted.)# Find the "Merge & Center" control. XlZ 4 R%T%V.* * '6d *!| '6kk< Create the chemistry formatter button. It is stored in the' "ChemFormat" toolbar of this workbook. 8 Place it on a toolbar. 4 R%T 6 ChemFormat R%T%tB@~ChemFormatCKTSU 6 4 R%T%t(\3 Make sure the command bar containing the chemistry; formatter icon is visible so that this add-in can be used. 4 R%T! 4 R%T(kd Place it on a popup menu. L!@ 6 ChemFormat R%T%tB@~ChemFormatCKTSU 6 L!@%t(\ Make the parent bar visible. L!!l  L!!!!l d L!!!! L!!!( Else2 User has place the button in a popup menu located4 in another popup menu. Let the user handle whether* or not the parent command bar is visible.kkd L!! L!(kpkhk`|XPP #)17!An unexpected error has occurred: f  Error number  ! f  ! f /This occurred while loading the button handler. f f#Let me know and maybe I can fix it. fChris King, cking@troyst.edu f fLast Updated:   f f"The latest version can be found at f spectrum.troyst.edu/~cking/ j A@d Keep tryingoh xB Removes the toolbar button and saves the location, if it changed.]]]]] ]8@ To understand what's happening here, you have to know that a> menu popup control contains a second control: a command bar.@ The controls on the popup have as their parent the command bar,( which has as its parent the popup menu.? Custom popup menus all have an ID of 1. The command bar ofB a custom popup is given a distinguishing name when it is created,A such as "Custom Popup 110993829". This name isn't accessible to the user, except through code. 1 Unload the "handle button enabled" class module. /. Find the button. XlZChemFormatCKTSU\ R!T%V.* * *55l 5cbcButton.Parent.Parent5Z'8#sToolbar = "" ' Not used for popup.5\':q 5'< Command bar named` '85'-sTag = "" ' Not used by toolbar or menu bar.sName = "" ' "kq # Record its position and delete it.5|'C@lqk     8 " : $ < &) Button was moved. Save its new location 7!B@! Removes undo info.  ToolbarName7n(p  ControlIndex7n(p 8 ParentType7n(p :Tag7n(p <Name7n(p9L Could put this value in sToolbar, but would make the code harder to follow.C@qd (k| #)17!An unexpected error has occurred: f  Error number  ! f  ! f 1This occurred while unloading the button handler. f f#Let me know and maybe I can fix it. fChris King, cking@troyst.edu f fLast Updated:   f f"The latest version can be found at f spectrum.troyst.edu/~cking/ j A@d. If error occurs, exit without doing anything.o]P8 When Excel starts, the storage toolbar is left enabled. XChemFormatCKTSUstorage R!T%V.> > ChemFormat R%TB@lk@ Starts the class module, which enables and disables the button. !R / B@oxAttribute VB_Name = "ThisWorkbook" Bas0{00020P819-0C$0046} |GlobalSpacFalse dCreatablPredeclaIdTru BExposeTemplateDerivBustomi&zD2' w contains the procedure o tall and remove ' chemistry formatter ton $tool bar,to startend!ss moduthatGrols wher or n otN0is eBnid. $T#@.3a "?rag@-#"",phold;CB#o be addeA' How @-/3@: 81) BxC ol#' 2) ach i@-oB@-in fi@9(from cie menu)3) Sas@\_clM 4@Mpy of was ced}am9r9, Deled9 )Excel !,EAaitiA"Glb@A"Docu@:tProperties"2怠D were@@yge*a{withfollowingiMte s@ 'I.C"..Add Type:=msoySng, :="TJJValu9@"FcaLi nkToCkent:=s__D! fIndexh9_$!!Num,be@{DPnt$01m/Tag(3 ? >B{ e [ren'ccessib`until!suL sett!\]utip 0comm@s("C Q").a!(1).dtexxt=c" & vbcrB" appl t sub-su TscriptslE vzs *t ; mak arrow`legaDntu1E5eEn fialaá` Oplicit DefInt A-Zim Class1 As N@ew ButhE%rbrcbInD l|ocbS?4 nT7(lIBDLongXsw)^s#GS(ub Ջ_IinInsll()Ns mWk!iDcbcSaC"Bar33psFul adIn- H1M2m cbQ bFoundCGB0eat @sK}s1pwwPopupR<p(n E-r GoTo 2$G8(0 upg Iqalydy0Des/, dcxi t. (Bcl0s@' i3us} du :I -e,, 9haps,`Ap@0r crash@$@doesAHfiО#{nRu;@a@8%h0a diff{9tagSe'= AaEc8.ws.F _R{ (erhS, ID:=1, `6`yGOCKTSUv"3NC I BothQT0#3/=258.E1R EP1In1 : ad.D;@ILeft(`q/, 20)`UX X "eF PC:<> c' AnUp "r3@3;Y'ӡpHdd@j,4& _'+mn#",MsgBox " mpt `beQmadA\ma qgdCeCk#"IJOTr73rsȀis:ost1t>,@in/2&@.Pathvbrd$"TP1 clogC2b\& "oo?o \ʶkbook.Path & vbCBr0_ "To preventoblems, one of the above should be reBm d.",OKOnly, "Chemistry Formatter Already Loaded"' Don't runlrestxis install routine. 'ThisWorCloseAddInsB(Buil,DocumProperties(01)).>ed = FalseR VesWw8. zck ma4rkaWY add-lYYExit Sub End If Next@! cbcButton.DeletG$H ' Re8triaAious locathionEbC WiITBmsT@oolbarN.CustomY@ Name").0Valu&AnControl[ IndexlI"D[Par}TypsTagNs2 ;bRN@' Make]l0 copCsBarWB I@@mC m agf B' 1idateAosi@in ca ap'4was dKdCIf 0 Then:' #. `{xa tCD Each cb In ApplicO.Command` spFi@b!dinS cb.$(ab CEna`db' Zexzs ef bFound= TrG[f7j>()@!-su + 13 -cdi'ex frominga0 large (chapp`5if:s were%;)/ =N.@ Cr`GcE kRpopup EuSet Rc6s`kTR.R$s(msodP ,`4, !o)E?NoѤ Is `h1,Sacbs)c.B/.0,he ; s-p,K0.v\# k">Pd O-O-O-ooC- P[=_5(r {;(p(ce#' U`Vde faultc' Can g(h9 :us@4W y&z @lac]1s afQU"M"eA& Cqer" u 'Ba"{+"\_W= i&m@6"a45gidm40d" ^orceW$ddgtosavPn P 0etwi aNw_ 2I' e$ " [o" foqsheet1 m!be1:cle5`odqt1`omiЮd.=' jX6 E/FUo`F y(q:=mG3, ID:=402G@<Gu}210AT` j{/Ccfijc@ItQ0r@ 1!hF'CS))!2ω21`Ю_(Dy9PMpy* :=V~, Bee:=eU2().S( CKTSUsu5@cs +ainA0%E ' iAvisi@ soCat@pn<0LtK V,n +(R!??!!!cb?Gqe} Ҿ$nt.Comma ndBarntrols(nCoHIndex).Tag = "ChemFormatCKTSU"  ' Make the parent bar visible.JIf cbp P@. Type1Ymso~ Popup Then6a91GElsecVYNotK.V?d Ki= hTru>'H(' User ha@s placbutton in a pmenu locateNd j!nor. Letu1ndle whe Por IvcCBxisyEnd If =wa]\ NY % Exit Sub AddB[Error:1MsgBox "An unexpec] eioccurred:" & vbCr_?vbTab" numbwA .N  Descripti\Th@d"@uivloadingph@ler.+m"Dme know  maybe I can fix itf@r`K , c k@yst.edu ast UpdY: AsLAST_UPDATED'dN lversa$fou>\at 1's9rHum./~B/",9OKOnly, sAPP_NAME:Resu#Next ' Keep tryI`bIPrivK Work book_KinUninstall() ' R@emovesb4t8oold5a/sa}, if@0D c@9ged@Dimc#W As& c AsTc Strn#佣lIDALongLsNaK 'aTo dd0t!what'"s@dppe@g here, you`v o#Lt\ aA!cC Ma% sed"Da`m 'as eh( iH,awhichsitgg @Customlle@)of 1 Tjo'c ggivedist!4uish n'- t creKd"su@"110993829"`bisn't acces toQAa, excepQbroughdD| On HPaGos+%b1[B@lnG2-"G 4-enapd" class moTdueSiCQ1.Appa2Fi7a s'Acb1= `li@sP4#ls.D0 A(Q:=mso, ID:=1, :=`O`=cmIs  With;  ﴒh.  ϓ#'&SK@= .ID 'E"P `$d f_P"2sVs#.`ny #GGDNˆ-ߕ ~0QS"Pacby3#[K[?' "QvvS1ccord@`Iosi!Wdelete{p)n- " .DP'<> mOp54@qR 0SI' 7 wNm5sd`MSA]1Zne>wӰ= A6iswp.Sheets(1).Cells.Cle@˗@%xofo".VDocntProperti0es("$q ").Valu%?542HO("%(P%`%pt! t dp Dl,=x)tp, lxc8,:`%%pt! t dp rU 8@q ) Q H  1 y) 1 QI 1Qyy  Y )!  !;y :1:L1``` IW Ky L'%:%( %0%@D! D d@ Dl=x)D@ lxc $ >1t!D$ L QD[p pa&V5q9pan`F :0 ]36opa!`#lt=/5mpanpa#l$ P $ 0' '0:0 N*#*#*#*#`#*#*#*#*#*#*#`#*#*#|*#x*#t*#p*#hll*#d*#`*#\*#X*#T*#LlP*#H*#D*#@*F 2:|xtphld`\XTLPHD@6 0  p '0%x  V>:0%D DA`#8/D67:0%D DAU<D68:0%D DA"@D6>:0%D DA`#D/D6>:0%D DA`#H/D6c 8Cl <pj @qd DC` HC\ld?*@D! D dQ@[XD<X lll0/-X k#pVZkj llF0%@D! D d@ H  (l)D@ !V llF0%@D! D d@ H  (lpj)D@ < X<LJ'%l`F%ldi %0 %@D! D d@ xQP)D@ lPcJlPLJ#LW A!l\F0]36; lL="HpV,kjDH P"D (lD1(DH P"D (lpjDJ L kV  qd#Cl $8b '%'%'%(% %llF0%@D! D d@ H l =x)D@ lxc pj x lpjldllF0%@D! D d@ HkjD%Qo%(%: %% !  d H  , )D@ 5]kjD % llF0%@D! D d@ H  , ) D@ CllF0%@D! D d@ H k)D@;llF0%@D! D d@ H )D@t zDH L"kjD%QDo%( % :0%%@! @ d H  , ) @ 5>kjD0%@DH L"D @ , )D@'DH D lD2 B@DH D @W&A'0]3)D@6 - =@DH D @W&A()D@6+ 2c0%@DH D @W&C()D@5r "DH D kDp DH D D )DD * )@@ ,*'':0+N,*#-*#.*#l#*#*#-*#l*#*#-*#/*#*#*#|0*#x*#t1*#p*#l*#h2*#d3*#`*#\*#X4*#T*#P-*#L5*F 24|xtplhd`\XTPL)D@6  d Lx\X`lHLPpt,|xtplhd`\XTPLHD@D@ 0 cC8`Kc=[`4$6 $7`c=7[`4`L'%:,%(<%L%\`! ` d\ Dl=x)`\ lxck lx` Q`  l ` Q`W8"ql5W9`1h5c >1d7 ql >1tc  l pr'L% c>lt8=kr<ll@lhD=ldH= V8\(LH, )tp,'t$  Qt[p4$6 $7p ?P(bxtp,LLLHSheet1 ,__SRP_a?__SRP_b CBUndo N<(SLSS6"N0{00020820-0000-0000-C000-000000000046}(%H` % %`h8@?$*\Rffff*363fa91dcd4xAttribute VB_Name = "She@et1" Bast0{00020820- C$0046} |Global!SpacFalse dCreatablPre declaIdTru BExposeTemplateDeriv$Bustom izD2rU I;!9q;34q99`rU @nrU~| 1 1 q H 7i(73/?*\R1*#175$*\Rffff*373fa91dcd*\R1*#228*\R1*#229*\R1*#c4*\R1*#b3$*\Rffff*343fa91dcd*\R1*#cd*\R1*#b8*\R1*#c0*\R1*#ce*\R1*#c0 N LP L N @ JP $ ,4P@X :     ( 488p "  L 6(8 P ` 'p  + "  >   "  0L(e040xME08 > LL"LLPL*L<4<8<<< ‘@“P@„ @☢@B☦B ☨hB % `Fk` ) s be% 8`(k**')  %@x@t0@png t h` hkJJQ xe "u% tds o% pmete%@lfier@h@d@``^ ow a`X sta ` lk88 xnumb% tecor% p%@led. @ht.@d@`!`^ `X`—@‖@‚( @☠xB☤B☪C hhP8( x@T`@l @\ R@L @H @F P(@R@l @h\ x@X x@X T `tLCp ( Pce@D  C@4 @$ tLC@ `JC@ @@ @ C@ J@( @ @ @ `X  xP88 h P  h  R@ T @R @ @ @ < @ 8 @ ( @$  `,%0 @@  X  @ @  @  @ @ @X @ @ @( @@ @ @p x @h @ ;P8 hP h `R@ T @ D @ @ @ < @x, @( $ `,%( @8  P@ 88 @ @ @ @ @ @h @  @8 @P @| @l 80 hh@ &P*x 6 < < NY0 > (0P &`* > ,a : @  D`  %  " $     ( 0 8 @  "H  +X  h  "p  1 W           > >X            ([  .s@ p P H    ( $0  =X  p         ,s     <   0  8 H  DP   %  ( ( D&  "0 @ "HPX`hpx  "1W      0 >8 >x       ([0 X h $p =      4s  ( 0 <P h x  ((D&N& "`pH This module handles undo and redo operations. Cell contents are storedF in ThisWorkbook.Sheet1 before they are formatted. Undo just puts theatteF contents back in the original cells. This is an exact undo, which isG good. Unfortunately, it destroys the contents of the clipboard, which is bad.C This method doesn't work for textboxes because the text looses its formatting when it is copied.0\ & Entries initialized by UndoInitialize]@]@]@% For reselecting the formatted cells.<]@]@(1 Counter of number of cells that can be "undone".]@P*, Records original setting of this parameter.C Column identifiers]D]Dx]D @]D]D0" Row after which undo data starts.]Dh0# Number of data points in a column. E Sets number of entries to zero, and records information about c, the0 range about to be saved. Called by ChemFormat. !!!' !!' !' !'' R!'o`8 Saves the cell contents, in case they are to be undone.]]]   R(k    '   ' Save the address and contents. % !  7( 6 The following destroys the contents of the clipboard; 6 this is a severe disadvantage of this undo procedure.  7 %B@~9" Merged cells are stored unmerged.qx  < e8 About 60 columns of data can be undone, excluding cells! with formulas or that are blank.  '   '     ' ' Save the address and contents. % !    7(    7 %B@~qk4 If more than 60 columns of data, the above silentlyen war ignores the excess data.= If "Copy Objects with Cells" property was changed, reset it.+ F   R( allk8o08 This is the "Undo" procedure. all]x]]]]]] ]8]P R(ame of R!' a s  R( variakx %.ng.  $%.ted. B@Format   of cel  ted   'y d 7 If more than about 65,000 cells are to be undone, then 7 some of the data will be stored in columns offset fromed the first.anged.     's prot   'ow 'tok  Save Redo infoTh    7!p %.    7 %B@~  Undo Fla I If the destination cells are merged, they are first unmerged, then the B single cell is pasted, then the destination cells are remerged. !rkshee'  Unmerge cells before pasting.No %!'ha (with ndx'kh  Paste the cellsd %    7B@~mine   Remerge the cells.xis la  %(ut B@xtbox,k $q= If "Copy Objects with Cells" property was changed, reset it.C T   R(thodkH  %B@H is  %B@!Redo Chem Format!ChemFormatXL2000.Undo.RedoTheUndo RB@2ell  R(oh]]]]] ]8]P]h] R(  %.A@d  $%.y form B@ontain   !p  !p   '!d 7 If more than about 65,000 cells are to be undone, then T 7 some of the data will be stored in columns offset fromdo the first.emForm     ' RB@   ' 'k  Redo    7!p %. !'  Unmerge cells before pasting. %!' (d8'k(  Paste the cells  %    7B@~   Remerge the cells.  %( B@k qh  %B@H  %B@Undo Chem Format!ChemFormatXL2000.Undo.UndoRecover RB@ Repeat Chem Format*ChemFormatXL2000.ChemFormat.ChemicalFormat RB@2 R(o Attribute VB_Name = "Undo" ' This module handle(s up , redo operations. Cell contents are stoLinWorkbook.Shee@t1 bef! 0they0 ma0ttedN just puO#H_back V origin>a}an@ exact, which ibsHgooe9tunately, it dest0roysJgoflipboard&$3bad.ethod doesn't wy 2 textboxbec0ause( loos itMingXenJ!1copi Op Explicit DefLA-Z BEn'nitialized (by I Priv= msBd As S ngIiRange ' ForselectA/f3 cgIA veQl2Lo@8Cou r cnumbeBB@Sat c!|be "ne"@ebCopyObj'sWithAs0@le@' Recordsset2aparter' Columhd@ifierpEVCt nUNDO_ADDRETSSAI@0g@.= 2' CONT(ENT 3 REo 4HSTARL4 &ow af`"$ldata arts@% lCELLS_IN_COLUMN!"<= 65500IN;" poi ~ara.0Sub [(c S)aSegE4ricto zero,>inUA abouI,{tr]Lsav"CallClChem`w`$ADk= c.Pnta "ClHhclaAddreNs`Kbg= .g= 0c _ pA.Qd End @-C%.Sn-`}n s###(t`%Dim lRow!jq$Off pIf mThenB $AFalseaIfB &< Ti m+g+ 1"  ifni' a(K a;QECH As(1\C.J(,k).aRutlacjD#~e jllowa[p7Pe cp;e @'@ Q ?evedisadva8ntaPbSAprocedurec 1, 1)]B(  BQ)AMergUe؆~m! EP_H0* 60$' 6A@`c^af bIf,,ІcludA2i%' wf}Qm`ejAb0lank "= #W%1(-@ \*(M-t+ ) 9,8lD* b +++O+lls+s+` ol?,PA V/# 1Eo4"N@' "ЁabvilelyB' ignPexc #4"V 4S" " `2еty was c.,ts P+P&_Pb O`w>(vUa"ѦB >1^SA}sa^Sl{rngqLc_c!bBR3f0gHeightS;lCaScreenUpP?== di`3B?m/zV %1Џ E=P!|is7v8t= 5s();sg.b >O0g L1 ToGML <=L -  PLJ{ua^Xd!7b 0fromirsts<P6 ZPZZ= (L `B;l]= lOffset * 4 End If(' Save Redo inf o4SrngAHctiB= .Range(.Cells(lRow, nUNDO_ADDRESS + lCol).Value)PL<1, 1). Copy OREOCONTENTO IT' Und '{If the destination cW are merPged,yfirst un n2 single$ is ppast#6re+.&OMG Thend bd= Tr UZ|"/χȇ‚χ̇0 .RVLc 3?w ?w?wP(6?w).?w ls.t?w ?wA' ?w;wf_  _x"h T2RC/G_x= ' WB+Ե_xSx_KZ0NrleĴmslvOnil "RlmlRecoverlqr/+3.p~l?rqr__SRP_4E__SRP_5 ~ButtonEnabler~Y__SRP_2+a8 8)1)i1 1(H al=\AL`6l\L H alA\`6l\H al`5l'H$ (Hal` H5l +F H$ H tkFH8$b Hl\L ." l$ l xl&qx*X(\%l$ l d QXTl6H aD`F%x@(4%T C 6DYx@(4%T %(%(%H aD ll l6DcTY;Yqpqxlpqt*X(\%l$ l d QXl>H aD`F%x@lti4% C 6Dax@lti4% %(%(%H aD ll l6Dc % l$ l xl,bT$lXDx" T$ T T+R T$ T tkRT {" T$ T xT1<(@%T$ T d l<=x)T<W$F(%8<F@%T$ T D< 8 d l$=t)T<8$ t ( lx ldllQllqhllqhllq`l`qd[lhi@%ldi%T TA<'%t Q<pT6slhi@%ldi%T T%(%(%pa <"PLLLPR@N0{FCFB3D2A-A0FA-1068-A738-08002B3371B5}h(% %*<0@ %H% v(`nk( )y f wh%)|`% p fC% `Nkh,)y %)|% p%@:pn`l  H`zk0( ``,k4.i ce xB#%0bt4 @(Hx8`X@$hpH` yxpH |t%p@n Px yx%p |t %( 0  =@h @(d @ @`O h( @P <( @N H0t @z HtXR @0t @p >@`` @xP @@ @0 ([@, xx8H8 L8 ?*\R1*#226*\R1*#22a*\R1*#171$*\Rffff*353fa91dcd*\R3*#50*\R3*#92*\R1*#b3*\R1*#229*\R1*#c4*\R3*#30*\R1*#b3*\R3*#4d*\R3*#5188@ ? : >P   : "  & @H " PX`h !p         &  "  HPX "` 8h   "  <DQ  2h      H0@x\4 The only function of this class module is to enable8 and disable the chemistry formatter icon when workbooks j are opened and closed.] 8orig3 Keeps track of whether or not the icon is enabled.`]@x] Make sure the button is enabledA@o(]]]   ! : ':C :'y@k8k0   Workbooks still remain visible.A@d No more workbooks visible.A@ko1 Can't load an add-in unless a window is visible.'tA@oHH6 Make sure the button state matches the desired state.] t E XlZChemFormatCKTSU\ R!T%V., Don't try to enable it if it doesn't exist.G $  0P 2p " " 4 DH < @ (  B8 B   F D8 J H B8 X`  <h8 y42 xME\@(((> LL L<`p trol`@n D e Blfor X@Dje PC`FXh (`Hf ha Jd @Lbthe `N` !`P^  R\p5 T @TZon a`VX ( `XV Use@ZTn Do@\pR@^Pt of``@N tter+b`k`i4 in ti8ed b@r`v @:t (ꐔxHꐒ0H‴(@P((  %R@x @t @p ( .February 23, 2003(XP x8h` 0 H x   H p  This sheet is protected. Chemistry Formatter cannot format a range of cells on protected sheet. (It may be able to format a single cell, depending on the protection.)D-GRThe selected cell is protected. The format of a protected cell cannot be changed.FThis sheet is protected and does not allow cell formats to be changed.7This chart is protected. Its format cannot be changed.Rd@8 D @ 4 @0 @ @  @ @ @ @ @P @ be@ ndow@h lica@ 1@ ICRO jns@  "$f0@ t @d @ `O 8  P`  V@ P H s@ L` p s@ H w@H DO w {@4 8 @0`` @p , H @ (O p p @ $ @ O @  @8 @P @h @  @ @ @ @ @ @ @( @@ @X @p @ @ @ @ @ @ @ @0 @H @` @x @ @ @ @ @ (X(x@ @< @, bfRhl@( @8 @ @P @h @ @ @ `>@ V@8 (VPs@` x8x@ `x@ @ `@ @( @ @P h(#@ xP#P%(@ @ X Xp`bxX8@d @T @D @p4 (@$ @ @H `  @ H (@ @ HP  P  " J P@  $ ( * $( *P B  Z 0"P&x:8T(p:> h8  ^X R D X  "` @ p  R " ( @ H5H "3   # < , '@ P  6 X J  .z * c@ <`73 80 -8 -HRDXD&  2 8P , 8 : 0 HP"TX 8   - 0&m@!h x D&3   J  h7 &  6 4 8 &X h  p 0x 6& 7 *( 0@H X!hx   *  !  08 @ 8H84 $% : :( h"d 1!  ,@H PX` h0Sp N& "h x HC "HX " ` Hh L H FH D "2*8.hFH:(.h88: H P X J`     * 6!LH!6! !!!  L"A`"  Bx"  J" 4#H#P#X# x# #  # # # +# ## ### J# 4H$ $$$ $$ $ $ $ %% %%%L.0% 1% % %% % % % %%&.& J8& &&4& >&& ' H' .P' '/' ' 8' &' ("7(( P(/`((((( ( (( l( L.() x) ) ) )) )  J) "*: (*h* 4* 0* * l* L1H+ + + 6+ 4+  , (, 80, &h, , 6,&,--- -(-  0- P-0`-%-- 4-- -...  . 8. >H.0.%.. 2./ /(/0/  8/ X/ Bh/0/%// 6080 @0P0X0`0h0  2p0 <0 0 0/101 281"2p11 01 1 1 82 82 <X2 62223"23 283p3"23 >3 83 4(4`4"2x444 24 .4 45 4P5 45 5 ,56 .(6X6 :p6 6!lF7$0 8$@8!H8P8X8`8h8p8x8 8 8 88  J8 :8 89 DH999 <9 9 $: (: "7@: jh: 2 : 4; .H;  &x;4;;4; <0< 6P< << @<<<= =  6= P="7h==== = 2= >"7>@>`>h>p>x>> 0>>>> > $>?/ ? @? P? X?$+p?? ?6L?*4? @(@ 0@ 8@ @@ H@P@X@ `@ B h@ Lp@ N@ TA :hA BA HA D8B*BJ*B C(C8C (PC ,>xC CCCCx\ Error message info.]$Chemistry Formatter]$February 23, 2003, Flag if some characters can't be formatted.)F]@* Set in DoFormat System-dependent variables.]@(]@(]@P. Initialize operating system-dependent values.hD= The spreadsheets containing the arrow or multiplication sign5 are displayed differently on the PC than on the Mac.9 Although the same fonts are used, the character sets are! not the same. Most unfortunate.< Ascii character 174, the arrow, is displayed differently on< the Mac and PC, so it is referred to by number, rather thanome by character.g $ 'o@ The multiplication sign symbol is also displayed differently on= the two systems. The mbPCnotMac variable controls how it isceD entered. It is used for exponential notation. On the PC, it is ing mA the extended character set of the normal font; on the Mac, it is from the symbol font. R!$ Win'k5 The linefeed character is 10 on a PC, 13 on the Mac.(  $'# Used for superscripts in DoFormat.oD Starting point of the chemistry formatter. Calls "DoFormat", whichI formats the user's selection. Also calls procedures in the Undo module. Created by:on can Christopher King " Chemistry Department# Troy State University  cking@troyst.edutrum# phone: (334)670-3576 < home page: http://spectrum.troyst.edu/~cking/ $S This originated with code in Dr. E. J. Billo's book, "Excel for Chemists", 2nd ed."] Type of sheet.y ]( Type of selection.|]@ Is worksheet protected.]X, Cells that contain text and are not hidden.]x* For iterating through cells in selection.]F User has already been warned that protected cells won't be formatted.] Return value from msgbox.]+ For iterating through all axes on a chart.]/ For iterating through all shapes in selection.] Type of shape.] Y Holds the name of the font in a shape. Has to be a variant so it can also hold nothing.]This sheet is protected. Chemistry Formatter cannot format a range of cells on protected sheet. (It may be able to format a single cell, depending on the protection.)8]RThe selected cell is protected. The format of a protected cell cannot be changed.P]FThis sheet is protected and does not allow cell formats to be changed.h]7This chart is protected. Its format cannot be changed. R('"3 Flag for not being able to format some characters.K MAKE SURE WE ARE ON A WORKSHEET OR CHART SHEET (Not really needed anymore) $'  Worksheet ChartA@ $Nothinge0( For chart sheet, with nothing selected.Nothing selected. A@dd@ !'6 Determine if the selection is a range, an axis label,& or an autoshape, textbox, or comment. $' RangeKT! Format a cell or range of cells. C The "SpecialCells" method doesn't work if just 1 cell is selected. !!v %!!!v$ Don't format if the cell is hidden. !! !!6 Don't format protected cells. Tell user the problem.  !  j A@dd02 Only format if it contains text not in a formula. !p$ !p$ ! A@ A@ %A@93 The "Cells" part is needed to handle merged cells.CFUndo Chem Format!ChemFormatXL2000.Undo.UndoRecover RB@ Hkkkd+ Format only cells that contain text and1 are not hidden. The SpecialCells method is fast% if, say, a whole column is selected.2 The disadvantage is that it can't be used if a3 sheet is protected, even if the user is allowed to edit cells.     % % .1 An error is generated if no cells were selected.@  Save undo location. A@  ) Skip merged cells, except for the first. ! !%! !A@ A@kp Undo Chem Format!ChemFormatXL2000.Undo.UndoRecover RB@ k d  A@dk k AxisTitleK ChartTitleKT(" Format axis label or chart title. Chart   j $d'dX A@k@ d8 / Can't select a textbox on a protected, locked,- embedded chart, so don't have to worry about whether it is protected. A@k S * If in a chart, format title and all axes. !$Chart Chart- Chart sheet.   j $d'd  !55A@k 5 ! !A@k qh k` d Embedded chart. !55A@k 5 ! !A@k q k d 2 Format text in an autoshape, textbox, or comment. !!v  ! !l'    "  $3 Here is one way to determine if the shape contains4 a textframe. The font name is null if no textframe is present. !&%(!*!'   !,!. !&A@kkk d& Some unrecognized object is selected.A@kknk '+/3'Some formatting could not be applied. f fThe "$ *"$  and "$ -->"$  cannot be replaced in cells or f.textboxes containing more than 255 characters. f-This is a limitation of the Excel programming f language. f f Chris King, cking@troyst.edu j 0 A@dkRepeat Chem Format*ChemFormatXL2000.ChemFormat.ChemicalFormat RB@2 R(|x #)17!An unexpected error has occurred: f  Error number  ! f  ! f +This occurred while formatting a selection. f f#Let me know and maybe I can fix it. fChris King, cking@troyst.edu f fLast Updated:   f f"The latest version can be found at f spectrum.troyst.edu/~cking/ j A@d< R(# oB Formats text, e.g., H3O+, as a chemical formula, in which numbersE are subscripted and superscripted. Asterisk characters are replaced/B with "" (the centered dot). An arrow created by typing "-->" is@ replaced with a prettier arrow. Exponents, such as 1.3E-22 are<= replaced with 1.3 x 10^-22 (but not in formulas or numbers).t]' Text in TextObject.<,]'# Number of characters in selection.=,](' Character position counter.tD]@' Character at current position.k`]X'8 Indicates a character is in a region to be subscripted.]p': Indicates a character is in a region to be superscripted.]'' Character following current character.]' Ascii number of that character.7(]'* True, if following character is numberic.]') True, if following character is a space.]'( Character preceeding current character.]](]@]X'8 Second previous character before the current character.]x]] 1E5 --> 1 x 10^5]' Position of E in selection.]'' Ascii number of the decimal character.]'= Number of characters in a numeric field that follows an "E".]'( True if a number field preceeds an "E". 4!(!v'8 8 G|j 4 8$b'6E Some countries use a comma instead of a period as the decimal point. f R%d$'\; Linked text is processed, but unchanged in this procedure.D ************************ Asterisk *********************************- Replace asterisk character with centered dot':_ : 6* h': : 8 'xXdP : 4%(B@jk(d xkD ************************ Arrow ************************************. Replace the arrow made by typing --> with the prettier "Symbol" font arrow. 8': 4_@ 6--> : h$l': : 8 'xd :7(B@l  :7(B@j3+ This string is operating system dependent.Symbol :7(!*( 8 '8 : ': : Gxjk dxkq 4 8$b'63 Keeps sText current.D *********************** Subscripts ******************************** Subscript numbers. : 8 6 :$$'<7 If entry is numeric Or the character "." ... </ <:  <. > ( Don't subscript if the character is "." <. : 4%(!*(ndH 1 Subscript a period in a subscript region only if  it is not followed by a space. : 8 6 : $$'< <  : 4%(!*(ndx'>khk`kXkPdHf UPPERCASE letters lowercase ) ] <A <Z <a <z <) <]'>dx'>khk` :D *************************** Superscripts ************************** Superscript + & - charges. 8 !' Only process if at least 2 characters. : 8 6 :$$'< <  < > space or linefeed'@f UPPERCASE letters lowercase ) ] <A <Z <a <z <) <]e'@  Else 0 If the current character is a number or charge, . the state of bSuperscriptRegion is unchanged.k @ 2 If current character is not a + or -, do nothing.  43 is +; 45 is -; 32 is space. <+ <-0 First, characterize the surrounding characters.'F- Initialize all to False.'H'N'P'V'X Following character : 8 6 : $'B B$'D D0 D: - Following character is a number from 1 to 9.'F D e'Hkk Previous character : 7 Determine if previous character is numeric or a space. 6 : $'J J$'L L/ L: , Previous character is a number from 0 to 9.'N L e'Pk Second previous character : ; Determine if 2nd previous character is numeric or a space. 6 : $'R R$'T T/ T: 0 2nd previous character is a number from 0 to 9.'V T e'Xkkk, Now decide which characters to superscript.6 Don't do anything if preceeding character is a blank. P Superscript the +/- sign : 4%(!*(p F, Superscript a digit following the +/- sign. :  4%(!*(pd`) Don't super script a number following ). ) T)2 Following character is not a number, so check the preceeding character.6 Superscript preceeding character if it is numeric and0 it is preceeded by a number or it is 3 or less. N L0H Don't superscipt a zero. V :  4%(!*(p+ Superscript if previous number is a 1 or 2 L1 L2e :  4%(!*(p8 Superscript a 3 if it is not preceeded by O. This will2 handle NO3- and HCO3-. (Can't win all the time.). 3 O L3 TOe :  4%(!*(pkX dP + The previous character is not a space, and( the following character is not numeric.. If the previous character is not numberic and- the following character is not a space, then- the - or + doesn't need to be superscripted. For example, n-butanol.& Exceptions: K+(aq), "K+,", K+!, etc. N H' Don't do anything if at start of line. : 8 : !4Superscript if not followed by an end of word token.! ( , . : ; ? ! tab linefeed D( D, D. D: D; D? D! D  D  : 4%(!*(p'@kkkkkkkkxkp :kXD ************************ Exponential Notation *********************3 Replace any entries like 1.45E-7 with 1.45 x 10-7. 8> At least 3 characters are required to hold, for example, 4E7. 8'Z_` 5 Look for capital E, beginning from end of selection. 6E Z $l'Z  Ignore if "E" is 1st letter. Z Z 8  6 Z $$'D d Digits + - D/ D:  D+ D-. Character after "E" is a digit, +, or - sign.( Therefore, a numeric field follows "E". Find the length of that field.'^% Must contain at least one character. : Z 8 6 :$$'< Digits </ <: / Still in numberic field; check next character. : Z '^d`: Not a valid number field, so last digit was end of field. : Z '^yk :0 A numberic field follows the "E". Determine if one preceeds it. 6 Z $$'L'` L/ L: '` L \e, Check that digit before decimal is numeric. Z 6 Z $$'L L/ L: '`d'`kdx) The word begins with "+E", so ignore it.'`k8k0 ` Exponent detected; format it. : Z Z ^  : 4%(!*(p :  Running on a PC 10 Z 4%(B@jd` Running on a Mac $  10 Z 4%(B@jSymbol Z  4%(!*(k?k?k?d?x?k??k?o? F This function gets the text in an object. Normally, you'd just writeG something like "sText = TextObject.Characters.Text", but this fails ifN the object contains more than 255 characters (256 for cell, 255 for textbox).3 Input: TextObject Ojbect containing text; nCharacterCount Number of characters in objectA Returns: a single string containing all the text in the object.] 6 Counts number of batches of 255 characters in string.]  Character position counter. 4%(!d'b3* Always get the first batch of characters. 8 8'r% Always rounds up. : r ! Add other batches of characters. b : 4%(!d'b :k@<i8<0<.Attribute VB_Name = "ChemFormat" Option Explicit DefInt A-Z ' Error message info. Pub\ Const sAPP_NAME As Sngistry ltero 9LAST_UP DATED =Februa<23,` 2003;Flag if socharacXs can't be fteBdriva~mbSTextNotFd8Boolean ' Setn Do~System-d@ependevariables.sAw_<PCnotMac6nAscLi`neFeeGeger>Sub OperatingGDFStuff()Initialize o s^lu.' The spreadsheetPontaini@ ta4A~u8lti@ signare d@isplay.d ifferHly PC@V@L' AlthPoughsAf s used,v s&@R . Mourtuny` scii 174Ã6, is/D1nand PC,@ is r e:r@=to by numberD, hher(a_H  'm= Chr$(%@o7 em[rmbol,also!.two@ s % &bFQX c@/rols how 99d@IB!3!k expon`M 1bBOn3$c$ie (ngd1Q: ofnvl nt;G.@4A!fromsyB!FC*If Le@ft$(ApT.!,f, 3)AWi\n"!_.m"= True E >\IfBeltftJH10aa"D\13>*|=c(vbLf) @&U]*su`vscripqinc| ical#StarA poid+.c@cŢr5Ca l`>"E", whichAlsB->r's plec; AO procedures dER_MSG_PROTEC9+,~ 57q)Qr-P !B (smaq$ ! ` %s ler$, c.)p CELL&q~C + ! 4 aw;UP0n ;d.CANT_FORMAT`b=do)* c @h_CHAR?@BItK r}PGoTo HPHl@* ScreenUpdnF'ӂˢto= r1r *EL!͐,0' MAKE SURE WP`ON A WORKSHEET OR (`` anymore㦸c`b!:(AP~vebecA<> "W_"l AhC Beep2 ElseaBSY ;L@s?pa$p0 MsgBox "tpspn.o7ts' DemA!KFR6a A,P/0Y1label,aKutoN o_, coma sFUå CaspType Case "Range"' Format a cell or "rl of@s.^Th~Spe cialCds" method doesn't work if @just 1is selected QIf Sion.P.Co unt = (1, 1).MergeArea -n DofqIt^tHhid8den GHNot (KRowsD.H OrKolumn ) BaDprot  Tuser ÁPblemMNDbPAndGL`ockedB@MsgBox sER_MSG_PROTECTEDCELL, vbOKOnly, sAPP_NAMETEls@'  \it contains text nVinula9DaIsNumericcValue) >jIsDateqHas@HUndoInitizeGXQC D Sav |DoG&' ' "" part need@wto handlle@dĐ&Applicatl$OnA "Chem", XL2000.Recover"t EPIf4J'!%oSc?`d JJ"' areM$}liCE+fastPi faa ba who.cB~17` disadva_geAthEAbabe @~daaPshee?ƅ, even… allowCed mDlȉOn ErrResq N yK `SrTV8isi@ /(xǁConst@$`s, xlb{s).D )' e"#gene&r@",noGweBw7GoTouH"nrq(Is hing' "u lo$tQ `aq?Cx Each c xIn Ek ipZE'xcept]ifirst $% c.Addresscz4|&aB HUcoeG- TTTTT RQb |y|, {QO 2 ? 3AxisTitle@i 7 laberchqkts #@"sSM?P""C"2 J:nRG=$(_CHARTDo{.&ߒz 0C"`sHАbo_pA ,' embe onhaPpry aboum'lPaR=o?#/'Brr",%" V `m axe Qa#Nam)P~nt)$Z"1't'B w((((cPWith _  .`;7Uu.":R/ sFiaAi.A( a  aJ/h/ ;`ϙC/Ud{&E;&en 0Shp#7Wn Type = @.T ' 0msoA7) Or T@ABox C?}' Here is one way to determiif the VSntainX'`frameD.  foTnnull noj A@L' ppresqvntFNVE&F ac3s(@1, 1).A . _<> ""Q"@ Not @(bProteXd A@yA=CrolV.Locked6) rF%@iFznu ' Some unre@cogniz"o,bj#!;sBpeds@Beep *mcr3mb!/ 51t )Msgi"fbting`_uld not be appli " & vbCrm_" Chr$(34)`\"* d-D->canr`eplac`chell@wr"Des%wmo}th255 cˠc.RTh @a limitaI oEx prog mg2rlua`DvpbTab# # K!, ck@troyst.edu", -OKOnly@vbIn3@, sAPP_NAME>A5c.OnRep e "ChemD@ "CCXL2000emB(icay"n ScreenUpd@ A0#= Trul Exit Sub rrorHandler:Re'An2expECeq haccurred:_ `EnumberB%.N*UADescrip o while]yB2a #=Qu )Let `Aknow/mayP5I 0. fix it( Ar!!B!8past bC;sLAST_UPDATEDB!A<latever.s R fd at@"srum.w,/~-/,+*?%2%rN$U@% 5b(MOVADs ) Esbw, e.g., H3O+, %8a cP0-ula, E$P}Csub"H ,p sup#"QA"svisk arE apeKw@ "" (хc}@d dot)P@0a,w 4Hd bPyp@ Z"Qi aHetti/pExp@ntsu1s 1.3Ex-22 q+ x 10^(b|ut^pF0V )@k Dim s! Str! P#-' 2qwCn ' $vO&  s2nd!_ $ S@viouPf4be Be# t character. Dim nAscNum2ndPrev5b4Cleric As Bo oleanFSpace B ' 1E5 --> 1 x 10^5nnPosE ' #ition of E in selecDecimalJ'cii numberIthe dsLenK' %sNa2field that follows anP "E"[b!B0efor :' True if +8*preceed( nCount = TextObje. s.If <@iTh?Exit Sub  sAsGet(C,)B #' Some cA$ries use3comma@Lsteadda pMod as@Mgpoint/L7z=t(A@pplicaI nnal(x"lD Septo r)%%LinkegH is processed, but unung@thdure"A*@&@"isk U#Repla@Cr with ce6@#dot Nb0BDo@GInStr(N + 1, l, "*", vblComCeh?N > 0 >@ B> 2553@mb; NotFormatt@O@WH @J!8lsek V(N, 1).Insert (""&nd IfEK lEgLoop 8rrowg89' 8amade by typing": d`ytti"Symbol"`wcM;tbW?AC&b!*,BRev(B@@B*B`CCMuCCF?/D@,:șC2).DtI` HmsAA4) ଱A|stra4}o@atsy@rm`pendp#2cI FoNa=^ :3&m(=- 29N - 1."6k A_KC3'rr%aaga' KeepsJ cur>r85#hscripts9V2 `gubts0J a1 To=? r0 g(Mid3HG'#s0 ryd`  Orl\"."X ..F$P(>` 47 AJ<0 58)A= d46Z b`zReg\0 ' Don't sV`qJ / 5v  co[ersd[0 A[(xa ronl`3` ' no@ipXPN ENN2VJTV p%W:/&jQEge$W?A/ǣɱ5' nO<t 27\'0 :?\У_09p[meF0#bq' sD or linefVdY5q/\/o//ElseIf (nAscChar >= 65 And <= 90)H Or 971 22Nt= 41p 93 Then bSuperscriptRegion @= True&'0 Els ?' the cur@rent cacter is @a numb o"rge, v' ;state oLf B"un*nPged.EI~fCtXVn$otX+ V-, do hin&g ;y43n+; 45-; 32space{K 3 ƀ QF irst,SizeKZound& sL@bFollow NumericuFaq @Anitialall to BS8_@pPrev 2 48*< 58) "!]{from 1G9/G @Q leC %@ 퇃Ί4' RiousF>#' De@mine if ~pgK a-@Bwa~ QCCs*M->MLKb@Kg@KJp'J0JA lIcE=wYI Hdxq' SecoO= uN > 2:Q$ P_$x_$:csxT$2_KcP$;%O%xK?%u%#Y' +KO&bt&KKno' J%obn ' Now decide@ whichNs19s/$(on'tѓanytᓔMcee;#?bla nk!Not ~b8/;2 ЌR+/- sig\!xObject.#a|s(N-.Font.^3P m1_ 6@digit fߪ Oc (/ / *, ߃ `D )o ~'c\@C<@1Oǣ , so ,eck'C^* 0]/.@}0̠bjxandepd by73lesO c3%r5Up8 4Dr;=PzeroG"jRc_9o,c,o,o,^ #G12og[\AH \49= 50n ֵ 1).Font.Superscript = T@rue ' a 3 if it is not preceeded by @O. Th2willhandle NO3- 1 HC ?(Can't win all the time.)O3O%ElseIf nAscNumPrev@51 And 2nd <> 79yen(CTextObject.Charact€(N - 1,5rEHIf<dK'.pvious c&wa spa8ce,hifo(llongOnumeric.\]T$b$6 [o'- or + doesn to be sed]8F@@examplUn-butanol] Exceptions: K+(aq), "K+,",!, etV@V(Not bV!P@[))ZCF7S!?)[!`[' Doa"do2ythingat start of line`N < ndCountN > 1@>')cSÔan e@gword8ken `P(,W@` NPx N" ' * Exponential =TaQXb' pRepl@sP`FtriesOke 1.45E-7th x 10-7G4O>=Ж%' At leastzs are requirN@ihold,d ff4EtnPosE!V  Do' Lookcapit PE,Poginn!q^fromTsel'TInStrRev(sQ0=kEk0ٝ' 0Igno ["E"1let0! aҙd: I= (Mid +̧'/Digits+-H(N > 47Ma< 58) OrWY= 43{5v' )( af@ da Bd, +,ё-P sigt br*e(e field%As!3q ;0' Fi{Alengs4P|thnQpLen.1!' Mu$ca4 >G_QN0E!2 To} w%NA_l% sT#% %! # /t]p pfR;eck nRfF_ Yl'U a vali um !, so lN& wasFp; 1P Ex o eTdw*A.3˟" /1,p4pDe05mP>' )asQ&`.L2Q- I1, 1))  bNumBefore = FalseIf (nAscRPrev > 47 And (< 58) Then~ TrudEy h R=`DecimalZ' Check that digit bd9is numeric.M:PosEk22a M(Mid(sText, n - 24=$yP~YzIf'R wordcgins with "+E", so ignite 9'E&1@eU' Exponenetected; m@0For N@Æ@+ 1 To+t n@L)Obj.CharBars(N.Font.Superscript@RԀN NnmbPCnotMac^' Running on a PC 6BInsert (" 10"`I('" &@r$(1h80)`" # ;3Nam!"Symbol"_VOCNO$Ex Do Loop  Sub Private FunctBi\Mp*(/) 6r ds upu\[M4P 0dd or H'$&H& W#^a*cEX]5=q; F%t@(%,PS5,1:V%t@(%&D $ QD "k&D $ QD ", 6D $ DW4+ #0 0/0D54 lx 0kr7'':N: *N44^pd64*D $ DW4+PPqLDlLA4,54UlLA4-4DD "D54lLA.4H`5D/`a46V54!`a4R0DD "D54 `D/v qL*D $ DW4+44q0Dl0A4,54'l0A4-4DD "D54l0A.4,`5(/`a46V54}!`a4R0DD "D54 `(/H q0* 8D $ DW41A( ]tD64 4D $ DW14$\D5 2 \a4l"pZ54%kZkZkZ d( %(%\a43DD[4a5anH)D64H: 6]@ 1kr\a47DDahVD64 !\a43DD "D54 \ 2 (    " 1" 1" 1" 1'': N#@#*#P89*#09*#:*#>#*#;*# >#*#<*#>#*#=*#>#*#>*#9*#?*#9*#@*#9*#A*#9*#9*#B*#C*F4 2>0 64& DED$ D PD" D$ D D FDD G F ,G'': NH9*#0B*#I*#l#*#9*# B*#l*#9*#B*#J*#9*#9*#K*#9*#C*#9*#9*#L*#M*#9*#9*#N*#9*#B*#O*F4 240 )D64" D$ D DD hP`HD,($ P4xtl`H\h)0 D4 SC H WlxFktDd%(D%H $PA``1x6$ tdY (bx$\_VBA_PROJECT*dir__SRP_0__SRP_11peratingSystem[Asc!uvbLfT%(ChemicalFormatLx sSheetType2sSelectionTypef bProtected rTextVisibleRange cZ bShownWarningnRetLAxisgcShpShapenShpType vntFontName&sER_MSG_PROTECTEDsER_MSG_PROTECTEDCELLsER_MSG_CANT_FORMAT?sER_MSG_PROTECTED_CHART} ErrorHandlerOScreenUpdating! TypeName ActiveSheet%NBeep SelectionZProtectContents MergeAreaRowsUHidden]Columnsp9Locked  IsNumeric$*IsDate2 HasFormula(UndoInitializejM(UndoSave(DoFormat7OnUndol SpecialCellsxlCellTypeConstantsW xlTextValuesxlCellTypeVisibleLAddressHasTitle{ ChartTitle_Axesb AxisTitle ShapeRange msoAutoShapeժ msoTextBoxID msoCommente TextFrame CharactersrgFontU ControlFormat= LockedText3^ vbInformationnOnRepeat TextObjectsTextnCharacterCountNenAscChar{bSubscriptRegionobSuperscriptRegionsCharFollowingPnAscNumFollowingTbFollowingCharNumeric:bFollowingCharSpaceT sCharPrev nAscNumPrevhbPrevCharNumerickbPrevCharSpace6 s2ndPrevCharnAscNum2ndPrev<b2ndPrevCharNumericT#b2ndPrevCharSpacexhnPosEwa nAscDecimalnNumLen bNumBeforesGetText InternationalxlDecimalSeparator vbTextCompare QInsertrInStrRevĈ SubscriptV SuperscriptMd mbEnabledXApp_WindowActivate1Wb_WorkbookkWn_Window6cbcFormatButtonSetButtonEnabledyApp_WindowDeactivatewnd bStillVisible/WindowsdClass_InitializenbState^ ErrorHandler3  UndoÞmsBookmsSheetmsRangeu msActiveCell mlEntriesmbCopyObjectsWithCellsKj nUNDO_ADDRESS  nUNDO_CONTENT nREDO_ADDRESSt nREDO_CONTENT+nSTART"nlCELLS_IN_COLUMN ActiveCellCopyObjectsWithCellsǜlRowlColxrlOffsetFormulaqY (UndoRecoverStorage WorksheetActiveS rngActive9Lc bMergedCells+ fRowHeight\! WorkbooksBActivate| MergeCellsک RowHeightMergeq_ (RedoTheUndoClassWindowActivatedtWindowDeactivate InitializeN AddinInstallAddinUninstallItemz _B_str_Chrm# _B_str_LeftV _B_var_LeftQ_Defaultj _B_var_MidpModule1b ChemFormat1.Undo1ButtonEnabler1/ ThisWorkbook15]Sheet11!Px   Z@@am  *\G{000204EF-0000-0000-C000-000000000046}#4.0#9#C:\PROGRAM FILES\COMMON FILES\MICROSOFT SHARED\VBA\VBA6\VBE6.DLL#Visual Basic For Applications *\G{00020813-0000-0000-C000-000000000046}#1.3#0#C:\Program Files\Microsoft Office\Office\EXCEL9.OLB#Microsoft Excel 9.0 Object Library*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\SYSTEM\StdOle2.Tlb#OLE Automation(*\G{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}#2.1#0#C:\Program Files\Common Files\Microsoft Shared\Office10\MSO.DLL#Microsoft Office 10.0 Object Library  Sub- & superscripts chemical formulas; converts * to " , ---> to a pretty arrow, 1E5 to exp. not.?4ThisWorkbook343fa91dcdThisWorkbook6xI Sheet1363fa91dcd Sheet10Undo373fa91dcdUndo00ButtonEnabler353fa91dcdButtonEnabler.ChemFormat383fa91dcdChemFormat2xy0xġ̍FG$ơ̍FG$@$ʡ̍$$̍FG$̍FG$̍FG$($$HK Excel+ VBAWin16~Win32MacVBA6# ChemFormatXL2000>?stdole`Officeu ThisWorkbook| _EvaluateaXZqClass1+ ButtonEnablerA msToolbarվ mnControldmlIDQgmsTag8msNameWorkbook_AddinInstall cbcButtonCommandBarButton9 sFullName~ad~\AddInexsBarNameu nControlIndexZBlIDsTag2sNamedcb\ CommandBar bFoundParentªcbcs^xCommandBarControlscbc^}CommandBarControlP cbpParent CommandBarPopup AddButtonErrorW Application* CommandBars  FindControl mmsoControlButtonnID]Tag&FullNameОAddIns InstalledMsgBoxRvbCr$Path2vbOKOnlyDeletexCustomDocumentPropertiesޖValueKEnabled۪ControlsKCount0v FindControls<msoControlPopupl)IndexCopyƿBarwBeforeVisibleParentmsoBarTypePopup-~vbTabc9ErroNumber- Description  (sLAST_UPDATED.+ (sAPP_NAMEWorkbook_AddinUninstallsToolbarnControlRemoveButtonError5ApptSheets CellsClearSaveSavedd Workbook_Open ChemFormat(OperatingSystemDependentStuff Sheet1mbSomeTextNotFormattedmsArrow% mbPCnotMacvV mnAscLineFeed0ChrK~O0* pHdChemFormatXL2000`TSub- & superscripts cRical f\ulas; c onver6* to , --->a pretty arro@w, 1E5exp. not.@eub@- &s perscipt hmi al+foE!m1la#;cnvA * t " ,-5->U ap#e3tTyarw1E5 QexH.nAt.a= ?* <stdole> s@d*l^ fB\*\G{2`0430-C 0046}#2.0#0#C:\WINDOWS\SYSTEM\StdOle2.Tlb#OLE AutozionC"Offi*cD"O@fBZeh A"2DF8D04C-5BFA-101@B-BDE5@"A*A@!42H"Program Files\CommonMicrosoft Shared\ 10\MSO.DLL#G 10.0 Object Library%"B4SThisWorkbookG" Th@5sW@Yrko@k 2 (HB1wIXB,!6T"B+B{S@heet1GS@#ezt1@ MC2N0UndoGB UnK2o 0p ,!e ButtonEnablerG@BUrtYoE`a@-ZrN2\//.-(& GCQ.mF@m`t +26ʠPm?2$arU~~~~~~~~o HiddenColumns Locked DThe latest version can be found at 6spectrum.troyst.edu/~cking/ i x S   IDTagF Cells Clear bThis occurred while unloading the button handler.V PThis sheet is protected. Chemistry Formatter cannot format a range of cells on protected sheet. (It may be able to format a single cell, depending on the protection.) Nothing "Nothing selected.ProtectContents Range CountMergeArea+ The selected cell is protected. The format of a protected cell cannot be changed.% This sheet is protected and does not allow cell formats to