ࡱ> o NM   !"#$%&'()*+,-./0123456789:;<=>?@BLDEFGHIJKAOPR`TUVWXYZ[\]^_Qabcdefghijklmnpqrstuvwxyz{|}~Root Entry F^05PX@6Workbook XCBQ_VBA_PROJECT_CUR"W4PX5PX  !"#$%&'()*,-/0123456789:;<=>?@BCDFHIJLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ChemFormat2Le 2Le 2Le (Chemistry FormatterChemistry Formatter applies sub- and superscripts converts * to " ; makes arrows elegant converts 1E5 to exponential notationChemFormatCKTSUstorageChemicalFormat( p(<<<<< ɀ\pChristopher King Ba= ThisWorkbook=hL,<X@"1Arial1Arial1Arial1Arial1Arial"$"#,##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"True";"True";"False" 0.000                + ) , *  `Sheet1T ɀ   MbP?_*+%"??U>@7 Sheet1 rU X$`$A` $`$n<jx40#<V@Vd FVBA4PX5PXThisWorkbook pl__SRP_7 C__SRP_6+*#51$*\Rffff*5H3fd85e0f*\R0*#19*\R0*#13*\R3*#2f*\R3*#8c*\R0*#14*\R0*#1*\R0*#e*\R0*#f*\R1*#df*\R1*#285*\R3*#51*\R3*#4d*\R1*#ce*\R3*#30*\R3*#52*\R3*#50*\R3*#4f*\R3*#4e*\R1*#1bcL$ FP H L H0 x   L ,  DP L D B0 x  (  z8 z F8    * " :8 @ H P X ` h p x        D D H DX & DL   F h   !    .9  8 80 h Pc 2h *  `h p x    4 >78(>H>`x        D(6*8 p  &$Z Z VHh p x    J   # $ 8H,P 2p(  |ZR46#TeDpHF]zJͷEek6x]zJͷEek6eDpHME|$[LSS DL*L L"<<(<,<0<4<8<<<@"(LH(L @(L<(L8(<<<<<<<<<<<<<<<N0{00020819-0000-0000-C000-000000000046}X%%RLx$%b"@@ %%b&H@@D % (x`Xo$ Cx` add`"to ad :8ph `,lar.@.hj`*d`0` `2\Save 6X%`4V :PP0\H% >LP% F8Hp% ` \kEE Cx %`t@r,H`*l`0h %h@%`2d@ ` ,k  7x8"p4(@%H pb8@@X@ i B 0<@b$D@0xp Xp X @0 @( @@ @P @ @8 @  @0 O @ @ @  @ @P @h @ @ @ @ @ @ @ @( @@ @X @p| @x @t @p @l @h @ d @ ` @0 \ @H X @x T vZ "$@ P @ L @ H @ D @@ @ 0 @ (H -p ` 0 2` &ftz|@  @ p B @ O  B@ @ @ 0 N@O @  R ] @h @ @ @ @ @ @ p  X p RLt "$@ ` @@ \ @ L @ < @( , 0 @ @ `  ` X (  `% @  @8 `X @h @ &ZxzP`%82@ h@  |v@@ @ @ @ @( @@ @X @p @ @ @ @ @ @ @ @0 @H @` @x @ @ @ @ @| @l @\ 0RL @t @p  @H` @pP en`@@ @0 @, ( @Ph X 8  X t @p @` @P @@ @0 , @@HpX   ?$*\Rffff*1B3fb60095$*\Rffff*1A3fb60095*\R3*#92*\R1*#d3*\R3   , @ <H  \  L( *x2b      B( .p* Z$Z0 VXxJ0] : B@C ;"; 7(Dz0*>x $' B  =2( @ 8P : 0   "   08@ H PHCX 8"@ HH F D FP . F H HX &  8     DL8       &  * !!  ! @! H!P! 4X! "! ! ! *! ! """ D>" 0`" " .8" 1" 1" 2# 1(# h1@# ### ### #HC# 4%% "%% >&6L@& x&8&&  F&'&  '  ' 0'X#8#P$0#P$x$h%$p$0$$#`$x$ $x$$$$`%$%h%@%%$ %%%%h&$%%%&%@ This workbook contains the procedures to install and remove theA 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. 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:=FalseCh{ThisWorkbook.CustomDocumentProperties.Add Type:=msoPropertyTypeNumber, Name:="ParentType", Value:="0", LinkToContent:=FalseUnsThisWorkbook.CustomDocumentProperties.Add Type:=msoPropertyTypeString, Name:="Tag", Value:="", LinkToContent:=FalsenEntThisWorkbook.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.s a se]@p]@]@0]@]@4 Adds a "Chemistry Formatter" button to the toolbar.has as] ]8]P]h]]]]]]]]8]XJ Clean up.> If the button is already present, delete it. (This cleans up9". > if the user created a duplicate, or, perhaps, if the computerOn E crashed.)= This doesn't find the button in the storage toolbar; that  button has a different tag.s1 RlTChemFormatCKTSUV L!N%P.Bon.C BindC? Check to make sure the add-in isn't already loaded (perhaps asSU a different version)othi !'" W :  :!th .Pa :!$Chem Formatter Excelhe :! "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 x/of the Chemistry Formatter. The first copy is: x  :!, x stored in x  :! x xThe add-in trying to load is: x  !, x stored in x  ! x x8To prevent problems, one of the above should be removed. "Chemistry Formatter Already LoadedA@v> , Don't run the rest of this install routine.Tag Or$ ThisWorkbook.Closemoved. AddIns(ThisWorkbook.BuiltinDocumentProperties(1)).Installed = False ' Doesn't work. Check mark remains in add-ins list.|kkk :tomDoc BB@Xrties(kX. Retrieve the previous location of the button.oper  ToolbarName7Z!\' ControlIndex7Z!\' d ParentType7Z!\'"LSubTag7Z!\'$@iName7Z!\'&6*q Make local copies.E5ex ', '. "'* $'0 &'2> Validate the position in case the parent control was deleted.b- * Parent is a toolbar. 6 L!N- Find the destination toolbar. 6! , 6!^\ Toolbar exists and is enabled.#C'4 . , L%N!`!b ionT Prevent control index from being too large (could happen if controls were deleted).mmon , L%N!`!b '.kkykx 64Sd Parent is a popup menu. f * 0 L!N%d.: :B+B > :S >!8! 2 The parent popup menu exists.n@[n >.F=I'4 . F!`!b mF"4m, Prevent control index from being too large. /o F!`!b '.k8y0k( >#/ skk Use defaults!e% Can get here if user deleted button.2" 46 Place the button after the "Merge & Center" button onh` the "Formatting" toolbar.'* Formatting',of0 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. RlT , L%N%P.B Bp '.d B!h '.***** kk< Create the chemistry formatter button. It is stored in theyping ' "ChemFormat" toolbar of this workbook.ar * Place it on a toolbar.> T If user deleted some buttons, the position may be out of range. Check and correct.3+ . , L%N!`!b s st , L%N!`!b '.k , L%Nl .n ChemFormat L%N%`B@jGxChemFormatCKTSU . , L%N%`(V3 Make sure the command bar containing the chemistryD *; formatter icon is visible so that this add-in can be used. , L%N!prs , L%N(p Pk@d Place it on a popup menu.7 . F!8!`!b r F!8!`!b '.R/k F!8l .n ChemFormat L%N%`B@jter ChemFormatCKTSU . F!8%`(V!B Make the parent bar visible.erio F!r!l tion F!r!r!r!l tlowed F!r!r!r!p F!r!r!r(p Else L%2 User has place the button in a popup menu located4 in another popup menu. Let the user handle whether UPPER* or not the parent command bar is visible.kkd F!r!p F!r(pAkkk|J #)17!An unexpected error has occurred: x z Error number  |!~ x z |! x z/This occurred while loading the button handler. x x#Let me know and maybe I can fix it. xChris King, cking@troyst.edu x xLast Updated:   x x"The latest version can be found at x zspectrum.troyst.edu/~cking/  A@v  Keep trying o xB Removes the toolbar button and saves the location, if it changed.]]]]] ]p@ To understand what's happening here, you have to know that apt> menu popup control contains a second control: a command bar.is n@ The controls on the popup have as their parent the command bar,+( which has as its parent the popup menu. s? 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. t0 1 Unload the "handle button enabled" class module. /ton . Find the button. RlTChemFormatCKTSUV L!N%P.B add B H B5r5l t 5rcbcButton.Parent.Parentta5T'*#sToolbar = "" ' Not used for popup.ze men5V'0q5'2 Command bar named'*5'-sTag = "" ' Not used by toolbar or menu bar.DDsName = "" ' "m Excek@q8 # Record its position and delete it.n of t5h'C@Xqk     * " 0 $ 2 &work) Button was moved. Save its new location 7!B@! Removes undo info.ms  ToolbarName7Z(\ol  ControlIndex7Z(\ L * ParentType7Z(\}Th 0Tag7Z(\en 2Name7Z(\9L Could put this value in sToolbar, but would make the code harder to follow.C@qHd@ (ropertk(|  #)17!An unexpected error has occurred: x z Error number  |!~ x z |! x z1This occurred while unloading the button handler. x x#Let me know and maybe I can fix it. xChris King, cking@troyst.edu x xLast Updated:   x x"The latest version can be found at x zspectrum.troyst.edu/~cking/  A@vhemF. If error occurs, exit without doing anything." & o]8 When Excel starts, the storage toolbar is left enabled.le RChemFormatCKTSUstorage L!N%P.6n" 6 ChemFormat L%NB@Xn kP@ Starts the class module, which enables and disables the button. A !L /ormatt B@ to thoAttribute 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' ckQHKo Oiel$oa ( a&u)Qs'6=>.7UY Eq7In&`@(` ad.A Left(`5, 20)R_ _ b"ePCVA<> c' Anp "q`Ҿ"Up43}`, SUa< m@uP(,MsgBox " Q̐mpt `be!m `6semvdClCArY* ~"$q)Z0> rsAis:oqytz,"@in2&@.Pathvbrd$"31i?gAJ2b& ","Ƕ & vbCr`_ "stored in"$TThisWorkbook.0Path|!To preventoblems, one of the above should be remd.",OKOnly, "Chemistry Formatter Already Loaded"}' Don' t run6re$st= False VesW"w. zck markainY add-lYYBExi t SubEnpd If Next@! cbcButton.DeletG$H ' RetriaAious locationEbC WiITBmsToolbar = .CumY" Name").Valu&AnContr ol[ Inde"xlID[Pa"r}TypsTagNs2 1)b'' Make.l cop`Q#HsBar +"$B @mC m agOf B' 1idateAosi@in ca ap'4was dKdCIf @0 Then:' #. `{a tCD Each cb In ApplicO.Command` sp,Fi@b!dinS cb.$?(ab CEn:a`db' Zexzs ef bFound= TrG[f7>(V)@!-su + 13 -cdi'ex frominga0 la@rge (chHapp`5if:s were%;)/ =N.@ Cr`Gc=E kRpoPpup uSdet Rcs`kTR.R$s(msodJP ,`, 7)% NoTIs ݰh)0c1`\sH p@1.B/.0,he ; s-p,K0.v\# k">Pd O-O-O-ooC- P[=_5(r {;(p=(ce' U`Vdefaultc' Can g(h9 :us@4W y&z @lac]s af#QU"MeA& Cqer" u 'Ba"+"\_W= i&m@6"a45gid@m40d" ^oHrceWddgtbosavPn P 0etwi aw_ 2ID' e " [o2"`fo@ eet1 m!be1:cle`o@  HomiЮd.=' jX6 E/FWUo`F (q: =mG3, ID:=402G@<Gu}210AT` j{/-cfS0Itwҡ(2C))2"1P߉ '@ 7some1ӑ3pemayq*`range‘correctV [`Ꮯ k"?/P J)9 ^py*P :=CL , Bep e|:= r3e().#( CKTSUf괸sucC aa cbpPaprent`sunt + 1 ` #=%#d_"ChemFor mat")J(1py _&:=g, Before:=Z  ).Tag = &CKTSU"' Makee pBU baraD_TypA{mso1Po]NA,CO\Գ'$' User@ has pthe buttADn loed 5anor Le"{a ndwheor );c#~"To2d`t w`'s 2ppe g here, you0vco&a{Kc#{ qaOtsed|p"aݰmH@H'{sMh` @Ui@Qj(M,1)3ch sit`XCustom4 `ll @of 1. S o '@ cC 3givea^distuish` n0=J`(cre%d su "St110993829"02isn't accestoQr, excepQbroughde On H aGo`C+%bS knAG,F"Fkenad" class `modul`SpiCQ1.Іq6' F>i07 S3 cb%1=s./ʕ(:=mso, ID:=1, @:=>=s&mIsɍWithw;  .Ӎh.  oĺ#'?&OsPq@= .ID'D"@P P0sVsä.`nAy FBGMbQ- 05QO" ib|y Z01K[?' "QvS8bcord_1IosiBVdelet)n- .DP'<> mO5v @qR OY2' 7 w0NmrdMS\Ynewsq A9Wisuw.S@heets(ellleʠuxPo info".UDocntPropertipes("$q ValuA%?5?42HO("BA(omDocumentProperties("Tag").Valu e = s8 .Cust0Name p ' Could put this vinool@bar, bw!%make&e code harder to f@ollow. SaveEnd WithElsTqWorkbPook.1dT ru 6If Exit Sub RemoveButton@Error:*MsgBox "An unexpected eSs occurred:" & vhbCr_vPbTab"( pnumbk.NDescription$0wE whileWloadinglYndler.+ "Let me know a@Xmaybe I can fix itF;P"ChryK@, ck@troyst.eduast UpdaV: sLAST_UPDAT ED>*The l versAI#A)+fou.at cG,ssrum.*/~./",sOKOnly, sAPP_NAMEBv' Ifs, eAw@odo>@NyngPriv+A _Open() Dim cb Asmm^BarCA' When Excel sthartt@r,agЃ aleft enabl4edSu= ApplicaJ.Co% s.Fi ndCon!l(msoD#, 1, @1d7 ql >1tc  l pr'L% c>lt8=kr<ll@lhD=ldH= V8\(L%` ` d:\W;<)`\51ltF,%:L%` `C`51krD,%:L%` `C`52lli,%:L%` `C`51lhF,%:L%` `C`51ldF,%:L%` `C`5  c $  )`` * )\\ ,*'\'l:L+N,*#-*#.*#l #*#*#-*#l*#*#-*#=*#*#*#0*#*#1*#*#*#2*#3*#*#*#4*#*#-*#|5*F 24|)`\6l\ `D,rU @Ia ya 9    A ya1q Aa IqQi 1Y I= <<aL1)``` IW K 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 lpjldF Zkj llF0%@D! D d@ H  (l)D@ V llF0%@D! D d@ H  (lpj)D@ llF0%@D! D d@ HkjD%Qo%(%: %% !  d H  , )D@ 5]kjD % llF0%@D! D d@ H  , ) D@ CllF0%@D! D d@ H k)D@A ;llF0%@D! D d@ H )D@ ;kj@DH L"D @ (l)D@ 7@DH L"D @ (lpj)D@zDH L"kjD%QDo%( % :0%%@! @ d H  , ) @ 5>kjD0%@DH L"D @ , )D@'DH D lDX B@DH D @W&A'0]3)D@6 S =@DH D @W&A()D@6Q 2c0%@DH D @W&C()D@5 "DH D kD 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)`\ lxcktxdh!|`\l\CL,'0%:@>%(P%`%pt! t dp Dl,=x)tp, lxc8,:`%%pt! t dp H, )tp,'t$  Qt[p4$6 $7p ?DP(xtp,LLLHSheet1.__SRP_aA__SRP_bEBChemFormatSH( TJ$Cb*l2Kx( TJ$Cb*l2KV@VdME(SLSS6"N0{00020820-0000-0000-C000-000000000046}(%` % %`h8@<<0?$*\Rffff*:o3fa902364pAttribute VB_Name = "She@et1" Bast0{00020820- C$0046} |Global!SpacFalse dCreatablPre declaIdTru BExposeTemplateDeriv$Bustom izD2rU <q:<84::`rU @nrU $h?$*\Rffff*5H3fd85e0f*\R1*#1b0*\R1*#22d*\R1*#24f*\R0*#f*\R1*#ce*\R1*#df*\R0*#f*\R1*#5e*\R0*#9*\R0*#f*\R0*#19*\R0*#e*\R1*#256*\R1*#1ab*\R1*#1d8*\R1*#253*\R3*#20*\R1*#97*\R1*#64$*\Rffff*1C3fb60095*\R0*#1*\R0*#14*\R0*#13*\R1*#ce*\R1*#df*\R1*#285B  0P 2p " " 4 DH < @ (  B8 B   F D8 J$X 4 xME@(((> h x ^0 R D 0  "8 @ H  R " (  H5 "3h   # < , ' (  6 0  -h   x 8  3   Z^z` * c < (P 8`0 - -RDB&@7 2 8 ,8 8h :  "T 80h p  - 0&m! (8 @B&P3   J  87@X &`p x 6 4  &   hG \GG HH xG G  ( 00 6`& 7 *  ! 0 8 HPX *p  !    8884P h$%x : :  "d8 `1p!  ,   0\0 L&8 "  HC "hx "  H L H  Fh D "2 *X.FH :H . 8 8 :(!h!p!x!J!!!! !*"60"Lh"6" "##  L0#,#  B#  J# 40$h$p$x$ $ $ &($  $ $ $ +$ % % (%0%8% J@% 4% $%% %& & (& 8& H&P& X&%`&L.x& 1& & &'  ' (' 0' 8'@'H'.P' J' ''4( >((&h( ( .( (/( ( 8) &8) `)"7p) )/))))) ) )) l* L.p* * * * ** *  J* "H+: p++ 4+ 0+ , l , L1, , , 6, 40- h- p- 8x- &- - 6-&(.P.X.`.h.p.  x. .0.%.. 4.0/ 8/H/P/X/  `/ / >/0/%/0 2 0X0 `0p0x0  0 0 B000%1(1 6H11 11111  21 <1 02 82/X2x2 22"222 02 3 83 8H3 3 <3 6324P4"2X4 244"24 >4 885 4p55"2555 25 .06 4`6 46 46 7 ,(7X7 .p77 :7 7!lF8$0h9$9!9999999 9 9 99  J9 :@: : D::: >: $7(; $P; x; <; "7; j; 2 h< 4< .<  &=40=h=4= == 6= >(> @0>p>>> > &> J> ? 6(? `?"7x???? ? 2? @"7(@P@p@x@@@@ 0@@@@ @ @ @ $A(AH0HA>0A AA $AB/0B PB `B hB$+BB B6LB*4C0C8C@CHC PC XC `C hCpCxC C B C LC NC T0D :D BD HE DXE*EJ*E F(0FXF (pF ,>F FFFPHx\ Error message info.11]$Chemistry Formatter]$February 23, 2003C, Flag if some characters can't be formatted.]@* Set in DoFormat System-dependent variables.]@@]@(]@P. Initialize operating system-dependent values.WI= The spreadsheets containing the arrow or multiplication sign\C5 are displayed differently on the PC than on the Mac.\P9 Although the same fonts are used, the character sets are! not the same. Most unfortunate.< Ascii character 174, the arrow, is displayed differently on!8< the Mac and PC, so it is referred to by number, rather than I! by character.I!$ '@ The multiplication sign symbol is also displayed differently on= the two systems. The mbPCnotMac variable controls how it isD entered. It is used for exponential notation. On the PC, it is inA the extended character set of the normal font; on the Mac, it is from the symbol font.X L! $ Win'k5 The linefeed character is 10 on a PC, 13 on the Mac.@ H $'# Used for superscripts in DoFormat.oD Starting point of the chemistry formatter. Calls "DoFormat", whichXI formats the user's selection. Also calls procedures in the Undo module. Created by:lPL Christopher King" Chemistry Department# Troy State UniversityD ( cking@troyst.edu# phone: (334)670-35768b< 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.@]( Type of selection.D@]@ Is worksheet protected. d]X% Format is not "protected".D@]p, Cells that contain text and are not hidden.]* For iterating through cells in selection.] Return value from msgbox.]+ For iterating through all axes on a chart.]/ For iterating through all shapes in selection.]  Type of shape.]8Y 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.)P]RThe selected cell is protected. The format of a protected cell cannot be changed.h<]FThis sheet is protected and does not allow cell formats to be changed.]7This chart is protected. Its format cannot be changed.p L('"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@vd !'96 Determine if the selection is a range, an axis label,& or an autoshape, textbox, or comment. $' RangeKT! Format a cell or range of cells. !! '  1 If sheet is protected and cell formats cannot be changed, don't try.   A@vdT The "SpecialCells" method doesn't work if just 1 cell (or merged cell) is selected. !!b %! !!b]* A merged cell has a count greater than 1.$ Don't format if the cell is hidden. !! !!6 Don't format protected cells. Tell user the problem. !2 Only format if it contains text not in a formula. !\$ !\$ ! A@ A@% %A@ <3 The "Cells" part is needed to handle merged cells.8 AUndo Chem FormatChemFormatXLXP.Undo.UndoRecover LB@"h formkd   $v', kkd+ Format only cells that contain text and S1 are not hidden. The SpecialCells method is fast% if, say, a whole column is selected. 72 The disadvantage is that it can't be used if a3 sheet is protected, even if the user is allowed to i edit cells.data.  * & ( %$%$.hanged1 An error is generated if no cells were selected.8 is t Save undo location.x A@  ) Skip merged cells, except for the first. !, ! %!, ! A@ A@ kh .Undo Chem FormatChemFormatXLXP.Undo.UndoRecover LB@"k d  A@vk k k AxisTitleK ChartTitleKT(" Format axis label or chart title.column Chart t    $v' dH A@ k0 d( / Can't select a textbox on a protected, locked, - embedded chart, so don't have to worry about whether it is protected. A@  I k Sx * If in a chart, format title and all axes. !r$Chart is Chart- Chart sheet. r    $v'd  !r bef5.50A@  k 52( !.x !4A@ kp ellsqX kP d Embedded chart. !r5.50A@  cellsk 52 !.B@ !4A@ k qkd2 Format text in an autoshape, textbox, or comment. !6!b H  !6 !l'B@  8  :  <Form3 Here is one way to determine if the shape contains4 a textframe. The font name is null if no textframeP is present. L( !>%@!B!'  .  !D!F !>A@ kkk  d& Some unrecognized object is selected.ls aA@kknk vbCr & "The " & Chr$(34) & "*" & Chr$(34) & ", " & Chr$(34) & "-->" & Chr$(34) & ", and " & Chr$(34) & "1.2E3" & Chr$(34) & " cannot be replaced" & vbCr &     'Some formatting could not be applied. x x(The *, -->, and 1.2E3 cannot be replaced x.in cells or textboxes containing more than 255 x.characters. This is a limitation of the Excel xprogramming language. x x zChris King, cking@troyst.edu  H A@vhkpRepeat Chem Format(ChemFormatXLXP.ChemFormat.ChemicalFormat LB@JXP.U L(cover| #)17!An unexpected error has occurred: x z Error number  |!~ x z |! x z+This occurred while formatting a selection. x x#Let me know and maybe I can fix it. xChris King, cking@troyst.edu x xLast Updated:   x x"The latest version can be found at x zspectrum.troyst.edu/~cking/  A@v L(eo(B Formats text, e.g., H3O+, as a chemical formula, in which numbersE are subscripted and superscripted. Asterisk characters are replacedtB 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).]' Text in TextObject.]('# Number of characters in selection.e]@' Character position counter.]X' Character at current position.]p'8 Indicates a character is in a region to be subscripted.]': Indicates a character is in a region to be superscripted.]'' Character following current character.]' Ascii number of that character.]'* True, if following character is numberic.]') True, if following character is a space.]'( Character preceeding current character.](]@]X]p'8 Second previous character before the current character.ܗ]]] 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".0] '( True if a number field preceeds an "E". L!@!b'P P G|jw L P$x'NΚE Some countries use a comma instead of a period as the decimal point. L!z$'r; Linked text is processed, but unchanged in this procedure.D ************************ Asterisk *********************************- Replace asterisk character with centered dot'_0  N* |'  P ~*  LB@~'xd  L%@B@kdxxkphD ************************ Arrow ************************************â. Replace the arrow made by typing --> with the prettier "Symbol" font arrow. P' L_ N-->  |$'  P 'xPdH 7@B@X  7@B@3+ This string is operating system dependent.Symbol 7@!B( P 'P  '  Gxj6kdxxpkh`qX L P$x'N3 Keeps sText current.D *********************** Subscripts ********************************Ѡ Subscript numbers.  P N $$'R7 If entry is numeric Or the character "." ... R/ R:  R. T ( Don't subscript if the character is "." R.  L%@!B(d 1 Subscript a period in a subscript region only if  it is not followed by a space.  P N  $$'R R   L%@!B(d'Tkkkkdf UPPERCASE letters lowercase ) ] RA RZ Ra Rz R) R]'Td'Tkk D *************************** Superscripts ************************** Superscript + & - charges. P !' Only process if at least 2 characters.v  P N $$'R~ R  R > space or linefeed'Vf UPPERCASE letters lowercase ) ]c RA RZ Ra Rz R) R]es'V  Else 0 If the current character is a number or charge, . the state of bSuperscriptRegion is unchanged.k8 V 2 If current character is not a + or -, do nothing.  43 is +; 45 is -; 32 is space. R+ R-0 First, characterize the surrounding characters.'\- Initialize all to False.'^'d'f'l'n Following character  P N  $'X X$'Z Z0 Z: ̘- Following character is a number from 1 to 9.'\ Z e'^kPkH Previous character  7 Determine if previous character is numeric or a space. N  $'`9 `$'b b/ b: , Previous character is a number from 0 to 9.m'd b e'fk( Second previous character  i; Determine if 2nd previous character is numeric or a space. N  $'h h$'j j/ j: 0 2nd previous character is a number from 0 to 9.'l j eQ'nkk k , Now decide which characters to superscript.6 Don't do anything if preceeding character is a blank.= f Superscript the +/- sign  L%@!B( \, Superscript a digit following the +/- sign.   L%@!B(d ) Don't super script a number following ). ) j)2 Following character is not a number, so check the preceeding character.v6 Superscript preceeding character if it is numeric and0 it is preceeded by a number or it is 3 or less. d b0H Don't superscipt a zero. l   L%@!B(+ Superscript if previous number is a 1 or 2 b1 b2e   L%@!B(8 Superscript a 3 if it is not preceeded by O. This will2 handle NO3- and HCO3-. (Can't win all the time.). 3 O- b3 jOe   L%@!B(k d + 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. d ^' Don't do anything if at start of line.  P  !4Superscript if not followed by an end of word token.! ( , . : ; ? ! tab linefeed Z( Z, Z. Z: Z; Z? Z! Z  Z   L%@!B(Û'Vkkkkkkkkk kD ************************ Exponential Notation *********************m3 Replace any entries like 1.45E-7 with 1.45 x 10-7. P> At least 3 characters are required to hold, for example, 4E7. P'p_ 8 Look for the letter E, beginning from end of selection. N$E p $'p  Ignore if "E" is 1st letter. p p P  6 Found "E" or "e". Is it followed by a numeric field? N p $$'Z d Digits + - Z/ Z:  Z+ Z-. Character after "E" is a digit, +, or - sign.[( Therefore, a numeric field follows "E". Find the length of that field.'t% Must contain at least one character.  p P N $$'R Digits R/ R: ١/ Still in numberic field; check next character.  p 'tdx: Not a valid number field, so last digit was end of field.  p 'tyk w t Z- Z+D Don't do anything with 2e- (electrons) or 3e+ (possibly positrons).d0 A numberic field follows the "E". Determine if one preceeds it. N p $$'b'v b/ b: 'v b re, Check that digit before decimal is numeric. p w N p $$'b b/ b: 'vd(?'vk?d?) The word begins with "+E", so ignore it.'vk>k> v P U' Exponent detected; format it.  p p t  L%@!B(P% (Needed for the next line to "take".  L%@!B(N Don't leave it subscripted. d= Exponent detected; format it.  p p t   L%@!B(͖ <  Running on a PC 10 p L%@B@d< Running on a Mac $  10 p L%@B@Symbol p  L%@!B(kp<kh<k`<kX<kP<dH<x@<k8<0<k(<o <8F 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 object9A Returns: a single string containing all the text in the object.] 6 Counts number of batches of 255 characters in string.]  Character position counter. L%@!d'x3* Always get the first batch of characters. P P'% Always rounds up.   ! Add other batches of characters. x  L%@!d'x" ϟk8i88eDim bShownWarning As Boolean ' User has already been warned that protected cells won't be formatted.(G CHANGES|0G END CHANGES GrF LegendEntryK GridlinesK TrendlineKSeriesKPointK DataLabelsKT Tr A Can't select characters in these plot components, so do nothing.G: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 "Wc" APmcrt{BeepElseBSY <@fL@P΀wa2u0 MsgBox "twupxr .+s7ts' DePmQKvR6a A,/`Y01label,pKuto2No`, comђ sSelectionType = 0Name()  D Case BN:"Range"' Format a cel@l or r6 dof s.;/b`CanCh!7= AveSheet.Prot@.Allow$tPingC]s KIf (b1ed And Not b) Then  \s: is p<#a#efl@s cann+e!ced, don't tryw4MsgBox sER_MSG_CANT_FORMAT, vbOKOnly, sAPP_NAME12Els;h "Special" method DesEwork if just 1g(@gmerVg@9A8)>s‡e.d-Gƈ..C0ount(1@, 1).MAreaJ _[A(a hasgA ter t@S v1O"DBXe6t heC5@ohiddUa(Vu+a@iC9,Next a_rEmbeddcAҚ)vhut0Y*slr(q?87 p' ctDin a@utoshape, box, or comm/= #wSRange.Coun`t > 0t0ShpiWn@$= .A4ms oA Or KT C܍' Here is one way to determiif 8the``+)nthain؇'0fr. a fo @*n null no5 ]'Apres8CvntF Ӡb+"Fb!acs(1, 1).=!.A/I <>< "4FNoht (HA@CrolV.Locked6)3 r*i ?b=P:s' Some unrecognizWXobj|sed9Beepn 39'vbCr & "` "Chr$(34)1* ,.-->Oa0 A]1.2E3M cannot be replacfZNu.m)'3ci@i numbt~hYn?(ericA(GY' True, if OH&YicSpaceK 8a sBPPrQx 10^5nPosE'J1' `#@E1aUDecimalu qUe d Le`^䁃Ub\field-bZn "E"X@B2Xcal O( @nKbC = TextObj@2.fs."IfJ <4ThExit Subs! sGetA(# ,M)" Rom Nri useommaA9steada iod asBTe3point&`<=`c(A8ppl$Se"ptorjLi8nke`1!processed, but un@8ngthdure#!X*isk 5"Repl!arH with$ cerdo*tBN.0"Do'!aIn(N@ + 1, 3, "*", vbс3Com`!e!@@=N > 0 ;M@> 255W@g>.W:="~dm LookAt:=xlPar c`#mbS!!NotFormattP0+` (qlse; .(N, 1).Insert ("N"ARIfeE+<E@ p O! Arrow!' Yamade by typafS!G4@@ttiw"Symbol"s+Q"Wq&2&Rev(%PP@/&!_& &&!! "CxP!2).D tO$h$ms)[bBsӖCo`LaRtsy=m@fpend13S$FoNNaS= /E==\- 2^N - 1K_ /cKC3'rr%_ej_e' KeepsNu86ls9V2 kE]Dws0J=qo= G0 j(Mid3HG'g#!ryi  Orbpa"." ..P(> 47 AJ`< 58)A= 46_ a' Don'tqJ / 50   co[d[0 q[(V}f$onlg`` ' P not@ipXsVN = 65 A<= @90) Or 9b7122= 4193 ThenbSubscriptRegion = 8Tru Fa Next NA ' * Sup_&s 'I + & - c@Uges.KZnYactCount > 1Dh' Only process@ if atast 2  `For NJo~ _@y(@Mid(sT@, N, 1)) C'E= 32nmLineFeedE- ' space @#lf @jPwj I[=r~ e?`i4`o$l`' `'` the curreIMD is a n`umbera3Q,K3'bstat7Lf 05un`ngedXc+kk`(o}"not B+-, d`Zo`thing ' 43+; 45-;AUP`  5X" First,nize%- wdr`CbFoll ow!~Nume8ricu_fIn itial all to "` 5 Sbm=bP8rev  2n>d_ h ' %g*@9N <-7@s = )1 C5ISiS0# D0> 48r< 58) P"G;a=fromd#9#((EVQ_Q62:E$ Pevo_$_$_$csxT$2_K$%O%x%%u%l' r4O& O&'bt;m K'Go' '%ob'' Now decide whichNs19s/$' Don'tѓanyⓔMcp:blank!N8/;2 pThR+/- sig|ObjecLt.aBms(.Font.3P mm_ 6a digit f .} TextObject.Characters(N + 1, 1).Font.SupTcript = TrubeEls.' Don't s H sIa number following )J.' )-If nAscNum2ndPrev <> 41 TXhenRFDc is not V, so check thw&preceed?k&o if itHumeric andg%ed by1( or3less&SbQAUAndYFX8BX$ {sca zero@lI[m -9@' Id_@Rviouía 1O2a6BK= 49 OrJP= 50?;a 3M_1HO. wiDll:' h`Tl@e NO3-U HC (Ca!~ allai tpime.UzcҀ3;iO2251 [79_3`_3ߩIaE mIfwkC 'A Wps`pace,` '?4ǵ. |' a8=?dxF -y+ d(oesSn t0o becCed=Fexampl*n-butanolExceptions: K+(aq), "K+,",!, etc{ +(Nu͵)ZVnAVS)--U]do"ythmPQat start of line 0 N < nCount xN >U_'Yaz)nn e3!` wordPken OF2(,N0m;?!tabAfp.F>Tl0P4#Qf6589633`m L -FQ@_)O`2ၑ= Fab(/RegBd _^/+oO \ N@ N, ' * Exponential TaQXb' Repl@sP`FtriesOke 1.45E-7 with x 10-7G4O>=Ж%' At lea st6vs are requirN@ihold,dr f4EtnPosE!V  Do' Lookyletp E,oginn!Q4fromUsel'TInStrRev(UC`ase(s0qlEPl3Pygno d"E"1CB Qbrd:' FPfd y"e"YIsA:c1fieldN?(PN= `(MidS, e !DigitsoO- (D $Following > 47 And nAscNum< 58) Ord= 4305 Then  ' Character af "E" is a digit, +, or - sign.?Vrefore,3numeric field f9s R9JFithe length of tXhat& nL@en = 1j' Must co@ntain leaone c+r"FnN!nPosE + 2 To nCountU7ˁ(Mid(sTexN, 1))'SDsIf (tC' Still Adbd;Beck n@*YEGXN@BHQ+Else' Not!valium"s, so lh was e}BOj$1% Exit x-@IfNNFNhIl 5)' Don't do anHyth!wi@b2e- (elec@trons)As3e+ (possibly ic(4' A DFwCqw Dem:iiio&Bmpreceeds it8Z$PrevgCp- 1hb`BFaNg m~hj TruR\A*ADec0imal6<"&Chaqb`bcdి2w)`a>1C_/`i2V/ \_+,5Wj CE~ w'9 word begins r"+E"` _# _s  qJ@`hcq2o25߃mbSomeo^Vmatted0:3' Ex:p`CnNEPd;Gr?  I{~1B{|TY O4bjpT.us( {.F.SuperscriptF ' (NM +ectlAQto "take": P{b^`ЌDve` su$edolx4pooooi% .mbPCnotMac= @' RunnxoХ PC& n!V.Insert (" 10"h ? ( " &r$(180)" x}5Name5"Symbol" _Pp;o TbDoX Looph Sub Private Functi$sGet( As 3I, ȡInteger)Str( h@fUgetsIFtAQn ocN Ully, y@ou'd jw(rit'иmelike "7 R.Q obutail@'Cs maqn ds (256E cell,U box)N' InpuP Then  M}IntZ( )/zsr?d0s up[9For= 1 To M' Sdd oPrNesO7& *Y9+ Q>>I)+Y++++ ,A,i,,,,,!- -. 00Q1A1iY2 1Yy4i44a5459555)755)6A7I6y6 8666 7y8Qq>t gBt x$ x tlt j#pk02tpx_ l R  t$ tpxj` K " D$ D D "D$ @QDo4 1x54lx=lx=t  2D $ QDo4 #00/0543'': N: N44 64 #D$ @DW4 VprD54'D $ QDo4 1t54ltC l 0-D$ @DW4AVppD64 krkp3'': N: N44 64zD $ DW4A( %(% $ ==A3)D6 4BcD $ DW4A $ WAĘ)D64=(D $ DW4D54D $ DW4  $ W   $ W')D64 -D $ lD= )D-D $ lD= )DD( %(%D $ D44 )D54&  !D$ D hD;7'': N: "N44^ pf64 krKTt % %%D $ D4#B#lD64K llc-D $ lD= )Dllh`mha4`F]( %(%haiDDaA$3)D6 4!ha4iDD D54lhDD lD=hD h`&  !D$ D hD3'': N: %N44 64 l&00l'0 lx0kr7'': N: (N44^ pf64&D $ QD &D $ QD  Dl)0l*0l+0l,0l-0l.0# 6D $ DW4/ #00/0D54N lx0|kr7'': N: (N44^ pf64w*D $ DW4/PPqLDlLA4054lLA414DD D54lLA24H`5D3m`a46V54^!`a4R4DD D54 `D3) qLI *D $ DW4/44q0Dl0A4054l0A414DD D54l0A24,`5(3? `a46V540 !`a4R4DD D54 `(3 q0 8D $ DW45A( ]tD64 4D $ DW54$\D5 6 \a4l"pZ54%kZkZkZ d( %(%\a47DD[8a9anH)D64H: :]@ 1kr\a4;DDahVD64 !\a47DD D54 \ 6     '': N#@#*#P<=*#0=*#>*#=*#?*#=*# @*#=*#A*#=*#=*#B*#C*F4 20 64& DED$ D PD" D$ D D FDD G F ,G'': NH=*#0B*#I*#l#*#=*# B*#l*#=*#B*#J*#=*#=*#K*#=*#C*#=*#=*#L*#M*#=*#=*#N*#=*#B*#O*F4 240 )D64" D$ D D` hP`HD,($ P4xtl`H\h$0 D4 C H WlxFktDd%(D%H $PAi`1x6$ tdYS (x$\`$`(`Q;,`Qq;&nrU~|  IAya 9  a8(88 9199a9)a)1A1(H al=\AL`6l\L H al?*\R1*#1b0$*\Rffff*1C3fb60095*\R1*#284*\R1*#db*\R1*#e9*\R1*#db*\R1*#d3*\R1*#e8$*\Rffff*1A3fb60095*\R1*#ce*\R1*#df*\R1*#285 N LP L N @ JP $ ,4P@X :     ( 488p "  L 6(8 P ` 'p  + "  >   "  0L(e04xME08 > *LLPLL"LL<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%@l@h@d@``^ `X`‖@‘@“( @☢xB☦B☬C hhP8( x@`@l @@\ of@L`@L hi+@H @F P(@L@l @h\ @X @X T `p ( @D @4 @$ @ @ @@ @ "@ @( @ 4@ a n@ `acteX ber fr xP88 h P  h  L@ T j@R /@ @ r is@ < char@ 8 om 0@ ( @$  `ecid %0  to su@@  6 DX  ything@ cter @ k.he + uperri@  @ dig@ scri@X the@ @ B(@( ) D@@ numb@  @p x wing@h 2 F@ ;haractP8 hP h `L s@ T H@ D zero@ @ @ < B(@x, scri@( r is$ `1 %(  @8  B(P8 S@ is 8ded by8 ll ( h@ . (@ me.)@ @ @ j@h @  revi@8 + T@P r is@| er i@l cha80not nu 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   %  ( ( B&  "0 @ "HPX`hpx  "1W      0 >8 >x       ([0 X h $p =      4s  ( 0 <P h x  ((B&L& "`pH This module handles undo and redo operations. Cell contents are storedF in ThisWorkbook.Sheet1 before they are formatted. Undo just puts theF contents back in the original cells. This is an exact undo, which isG good. Unfortunately, it destroys the contents of the clipboard, whichal is bad.C This method doesn't work for textboxes because the text looses its formatting when it is copied.he M0\ & 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. 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.X !r!r!'Wi !r!' !,'5 T !,'char' L!' 13 o`8 Saves the cell contents, in case they are to be undone.]]]   L(stry fk   Form  '   ' t Save the address and contents.du %dule. !,  7( 6 The following destroys the contents of the clipboard;y De 6 this is a severe disadvantage of this undo procedure.  7 %B@j9" Merged cells are stored unmerged.bqx  < eage: 8 About 60 columns of data can be undone, excluding cellsig! with formulas or that are blank.  ' C   '     'et.@ ' T Save the address and contents. I %ted. d !,    7(    7 %B@jntaiqk4 If more than 60 columns of data, the above silently in se ignores the excess data.= If "Copy Objects with Cells" property was changed, reset it.   L(fromk8o08 This is the "Undo" procedure.hart]x]]]]]] ]8]P L( T L!'.  L(ds thekx %.. H  $%.an als B@hing.   ted.  rmat   'mad 7 If more than about 65,000 cells are to be undone, thenng 7 some of the data will be stored in columns offset fromct the first.ed. T     'ell ca   '< 'etk  Save Redo infoow    7!\ %.    7 %B@jno  Undo. I If the destination cells are merged, they are first unmerged, then the B single cell is pasted, then the destination cells are remerged. !needed'  Unmerge cells before pasting.shee %!' ($dx'kh  Paste the cells n %    7B@jA@v   Remerge the cells.6 D  %(io B@ge, ank & oq= If "Copy Objects with Cells" property was changed, reset it.T   L(r rakH  %B@H'  %B@1 IRedo Chem FormatChemFormatXLXP.Undo.RedoTheUndo LB@Jn't tr L( oh]]]]] ]8]P]h] L(ll) is %.!  $%.!! B@* A m   ater t  $ D   ' td 7 If more than about 65,000 cells are to be undone, thenor 7 some of the data will be stored in columns offset from the first. if it     'rmula.   ' '!k  Redo    7!\ %. ! "Cell'  Unmerge cells before pasting.8 A %!' (XLXP.Ud8'k(  Paste the cells  %    7B@j+   Remerge the cells.ext an  %( h B@e Speck  fastqh  %B@Hmn i  %B@2 Undo Chem FormatChemFormatXLXP.Undo.UndoRecover LB@"otecteRepeat Chem Format(ChemFormatXLXP.ChemFormat.ChemicalFormat LB@J  L( ( 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 aU:|"/ߢ0 .2VLc 3w wwP(6w).w lstw wA' wwϙf_  ?x"h T2R#ǁ/G?x= ' WB+?x3x_KZ0NrlemsluOnil "R_lm]lqRecover_lIqq .~lq21qA\`6l\H al`5l'H$ (Hal` H5l +F H$ H tkFH8$ 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,T$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 <t!@@``desi`1  /o#iH OrrGoTo EAHtE3E@Not(= iA}=Ab.s.F* _ @1@(Type:=mso, ID:=1, Tag:="CYCKTSU"#9' Do9K! @_ifdoesexSgkMIsQ@ng-n,.%"D&nEB:+j:)B' e, Zv]t *id0pres e ("Should" get hpere.p"  PEyOX l xlt +r4 ,tx l xlt!h$ Qh[dp`{paP.V5Pl knpn knjpl`{ p`1kl +N4 +N4 08 d`txphPL 4 +z4+$  K4 Q,'0%:@%(P%`%pt$ t dp Dl,=x)tp, lxc  x  4P(xtp,8 <<@)@0trU L8`()Y 98`, )Y 9$9`0 (y`4i# @8n2*\R1*#286*\R1*#1ac$*\0* pHdChemFormatXLXP`LSub- & superscripts cN@ical fXulas; conver6* to , --->a pretty arrow, 1E5exp. not.@eub-P &s perscAipt E hmi aDl+fo!mQ1la#;cnvA7* t " ,b-5-> ap#e3tyarw`1E5 eTxH.nt.a= ?  <stdole> s@d*l^ f_VBA_PROJECTN!dir__SRP_0 __SRP_11  ( 4OHREiElp*=h8+3qcOD2uxcOD2uREiElpME SS Sa08(L@ D>"PLLLPLMN0{FCFB3D2A-A0FA-1068-A738-08002B3371B5}8(% %*80@ %%% (`Hrk( ) f wh%)% xhys% `Nkh,) il%)L % p\P%@pnkw`l  H`zk0( ``,k4.i  x%0b4 @(Hx8`  t `` xp t(%@r ( 8  Px x%p3 t%@h @(d @@`O h(@P ( @N H0@z HRL@0t @p @`` @xP @@ @0 @, xx8H8 L8 ?*\R1*#282*\R1*#286*\R1*#1ac$*\Rffff*1B3fb60095*\R3*#50*\R3*#92*\R1*#ce*\R1*#285*\R1*#df*\R3*#30*\R1*#ce*\R3*#4d*\R3*#518<@ ? : >P   : "  .8 & 8@ " HPX` !h x        &  " @HP "X 8`   "  <DQ 2`      H(px\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(]]]  be !p  ' '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.'A@oHH6 Make sure the button state matches the desired state.]   RlTChemFormatCKTSUV L!N%P., Don't try to enable it if it doesn't exist.SaveSavedd Workbook_Open ChemFormat(OperatingSystemDependentStuff Sheet1 mbEnabledXApp_WindowActivate1Wb_WorkbookkWn_Window6cbcFormatButtonSetButtonEnabledyApp_WindowDeactivatewndNe bStillVisible/WindowsdClass_InitializenbState^ ErrorHandler3 mbSomeTextNotFormattedmsArrow% mbPCnotMacvV mnAscLineFeed0ChrK~OperatingSystem[Asc!uvbLfT%(ChemicalFormatLx sSheetType2sSelectionTypef bProtectedbCanChangeFormatsx rTextVisibleRange cZ bShownWarningnRetLAxisgcShpShapenShpType vntFontName&sER_MSG_PROTECTEDsER_MSG_PROTECTEDCELLsER_MSG_CANT_FORMAT?sER_MSG_PROTECTED_CHART} ErrorHandlerOScreenUpdating! TypeName ActiveSheet%NBeep SelectionZProtectContents ProtectionAllowFormattingCellsh MergeAreaRowsUHidden]Columnsp9 AllowEdit! IsNumeric$*IsDate2 HasFormula(UndoInitializejM(UndoSave(DoFormat7OnUndol SpecialCellsxlCellTypeConstantsW xlTextValuesxlCellTypeVisibleLAddressHasTitle{ ChartTitle_Axesb AxisTitle ShapeRange msoAutoShapeժ msoTextBoxID msoCommente TextFrame CharactersrgFontU ControlFormat= LockedText3^ vbInformationnOnRepeat TextObjectsTextnCharacterCountnAscChar{bSubscriptRegionobSuperscriptRegionsCharFollowingPnAscNumFollowingTbFollowingCharNumeric:bFollowingCharSpaceT sCharPrev nAscNumPrevhbPrevCharNumerickbPrevCharSpace6 s2ndPrevCharnAscNum2ndPrev<b2ndPrevCharNumericT#b2ndPrevCharSpacexhnPosEwa nAscDecimalnNumLen bNumBeforesGetTextDecimalSeparator4 vbTextCompare QReplacefWhatC ReplacementLookAtOxlPart<InsertrInStrRevĈ SubscriptV SuperscriptUCase5 Md 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_LeftVsPathPath2AddIns _B_var_ForjLAddInex _B_var_AddInR< _B_var_IfP_Defaultjp InstalledFullNameО _B_var_LeftQ messageboxO_B_var_mes    ! "as  *\G{000204EF-0000-0000-C000-000000000046}#4.0#9#C:\PROGRA~1\COMMON~1\MICROS~1\VBA\VBA6\VBE6.DLL#Visual Basic