ࡱ> /2.c[@  bjbj44 "ViVixxxxxxx2222 > PVllll[[[\RXxW[xxll EEE xlxlEEXExxlJ I2 0P1 xxxxx[oE} [[[2; 2To use this add-in, place this file in the directory where add-ins belong. Then use the Templates and Add-ins menu under Tools to load it. This add-in is for Word XP; it will not work with Word 97, 98, 2000, or 2001. Detailed instructions are given at the HYPERLINK "http://spectrum.troyst.edu/~cking/ChemFormat/index.html"Chemistry Formatter web site. Chris King March 1, 2003 >?kl  K L M i j k l m w x } ~  hbEh=DhAhC hw/h=D h 6h=Dhklh=D0JjhUhjh=DUhdIhOh=D5h`N hh=Dh=D!l m x $$$gd=D  1h/ =!"#$%DyK yK phttp://spectrum.troyst.edu/~cking/ChemFormat/index.html@@@ =DNormalCJ_HaJmH sH tH DA@D Default Paragraph FontViV  Table Normal :V 44 la (k(No List VV Answers $h5$7$8$9DH$^ha$ B*aJphV>V Title$@&a$5CJ KHOJQJ\^JaJ N"N Test Item! h8hx^h`L"L Test Item indent h^:2: anchors$a$ B*ph.B. narrowdNQN MTEquationSection<B*CJaJph6U@a6 kl Hyperlink >*B*ph zlmx000p0   LiXH  or$-3HޮAb$uRZԳ/=ōb$%~J(v H֓w\"$ WIe]Hd2b$I<<-)&tTb$ʵ UiviT@ 0(  B S  ?Xx8*urn:schemas-microsoft-com:office:smarttagsdate 120033DayMonthYearCI:Christopher KingChristopher KingChristopher KingChristopher KingChristopher KingChristopher KingChristopher KingChristopher KingChristopher Kingcking+>b`|aX4OCMHVu| UhZ 0 m Q e | + 6 C G  3RA7HALzO-:r?:C8(nlnYVr  @!g!G"/"X" #@I#u=$s%o&'''6'7'oj'GJ(HA)A)[)ty)$*6<*Oo*34+;+NY-j- ...at.#/0k0 1.Z1T2l23K3j34a4t4 6A=6Q7+8,V89k95{9a):?:]:f: ;T';X<x4=y=Kc>:?B?l?zs?*:B=BEBXCD6D=D^ZEbEAiE.F_hF;G HGQGI%I,XIdIGJdK^4KBK:sK lL6MOJP{P~P:QP%SDSTQSIT+U=UV+VPBV WFWXWW[Z[,u[(]>1]oaB2b= d2dsMd\6e0f)h2h]Rh!ieii-kl0n_nznXo 'p8,q r4rj'rYLrqerkt~tu=u+]ukulu;vuv8w8;wpuxG^y/NzJ{R{4"|]|o|93}c ~}~f3DeI >,b0F|ks)_;Ri]S.DQvnV ,sZjEtO3+xF([U4MH>{3{d5"Mv{J8?p(*t );.Rx\pa&)Qyd_m57+1,?-H?9^F >X5KD> Y=q4kf -he|4>4D>Px6 HW7Z"8~"?RSezx} bIs AW JC&.AF#uJM0d&P t$;?E,KDz$C*O?\Q1v 0Z,1JBW"} ?L6^8o.w/?>AQVMh?<[~kllQe6 #!B-~D&W)[7 v A)( \y"SX@]< ,7`N\>)RT~/AAWOWGl '*rV1""V2""V3""  ChemFormat ChemFormat2e2e2e2e2e 0( Chemistry FormatterChemistry Formatter applies sub- and superscripts converts * to " ; makes arrows elegant converts 1E5 to exponential notationChemFormatCKTSUstorage"ChemistryFormat.ChemistryFormatter( p(<<<<<r%'ChemFormatWDXP.ChemistryFormat.AutoExec'ChemFormatWDXP.ChemistryFormat.AutoExit1ChemFormatWDXP.ChemistryFormat.ChemistryFormatter1'CHEMFORMATWDXP.CHEMISTRYFORMAT.AUTOEXEC2'CHEMFORMATWDXP.CHEMISTRYFORMAT.AUTOEXIT31CHEMFORMATWDXP.CHEMISTRYFORMAT.CHEMISTRYFORMATTER@P@UnknownGz Times New Roman5Symbol3& z Arial"hZ s:L:L!x24d]p3QH(?B-Chemistry Formatter Add-inChristopher KingChristopher KingOh+'04    $,Chemistry Formatter Add-inhemChristopher Kinger hriAdds sub- and superscripts to chemical equations. Converts * to for hydrates; --> into a prettier arrow, and 2.3E-5 into 2.3 10^-5$Chemistry Formatter for Word XP.dotChristopher Kinger 384Microsoft Word 10.0@gu@+wZ@(v:L՜.+,D՜.+,\ hp  Troy State Universityro{ Chemistry Formatter Add-in Title@0qy)5 _PID_HLINKS ToolbarName ControlIndexAh*8http://spectrum.troyst.edu/~cking/ChemFormat/index.htmlont  !"#$%'()*+,-0145789N;<=>?@ABCDEFGHIJKLM6OPQRSTUVWXYZ[\]^_`abdefghijklmnopqrstuvwxyz{|}~Root Entry FI3Data  1TableWordDocument"SummaryInformation(DocumentSummaryInformation8&MacrosAIVBAAFThisDocument__SRP_4__SRP_5 BChemistryFormat :  !"#$%&'()*+,-./01245689:;<=>?@ABCDFGHIJKMNPQRSTUVWXZ<jx>>#<k\G{s( Fж.Adb+\xж.Adb+\k\G{s(ME(SLSS6"N0{00020906-0000-0000-C000-000000000046}(%` % %`h8@0d?<$*\Rffff*2V3fb4b1674pAttribute VB_Name = "ThisDocument" Bas0{00020P906-0C$0046} |GlobalSpacFalse dCreatablPredeclaIdTru BExposeTemplateDerivBustomizD2rU 0a4A)0`rU @nP d?<$*\Rffff*2X3fb4b167*\R1*#d4$*\Rffff*2W3fb4b167*\R3*#92*\R1*#132*\R3*#4e*\R1*#155*\R1*#e7*\R0*#10*\R0*#9*\R1*#b5*\R1*#d6*\R0*#f*\R1*#e3*\R1*#1e*\R1*#21*\R1*#d8*\R1*#e9*\R1*#b6*\R1*#de*\R1*#dd*\R0*#2*\R1*#156*\R1*#1d0*\R3*#20*\R1*#78*\R1*#71*\R1*#158*\R1*#d0*\R1*#129*\R1*#ec*\R1*#c5*\R3*#51*\R3*#2f*\R3*#4f*\R0*#19*\R0*#13*\R3*#8c*\R3*#50*\R3*#51*\R3*#4d*\R3*#30*\R1*#133*\R1*#c7*\R1*#c8*\R0*#14*\R0*#1*\R0*#e*\R0*#f*\R1*#e*\R1*#c0*\R1*#c1*\R1*#17bX @ D@ F 0 , 20 h  D B  8  HP  * " BX ` hh " * L&( "0 88 p  , " <He0f (08@HP X Xg X@h Dh1i de,e  e Hf e Pe `e e xe$(D,`>} xMED " (L (L(L:8LP(LV> << <$<(<,<0<4<8<<<@*LLLLLLLLLL*LLL*LLLLPLL*LLLL<0 # @\hH%%%Chemistry Formatter March 1, 20032% &`h tk ` xk% H` o- pp %`l> T`2jutto dment%`` 7``\@"Z wit T(ollo %`jxR onta ` pk++ xValu%`tnt:=@ronta 0(`k@2z Val`4tnt:=`6r onta 8lxren'% <hed.%`f al l@>dutto`@T @B0R D08; (@F*Ch`H$Ch`J h`LH003 N# A%`R utto TE S%@XBs wh@Z`Bton |` kh) ass %`t."`pemis`l@>j`dmist`` to `\X@Z@X`V `T is Rete H@P> i`hN dup`L if J c @H't f`F e st`D   B a d x@@8`> rmat` < 6`8t@6@4lrea`82 s`@€@"(`@."H ^H@ x 2P(8H(`@t "@x .8@H L @ H `Bt`Jx  X0P 8  ` p p#@(D @x 4 @ $ @  @  @  @  @  @  @8  @P  @h  @  B@  @ @ @ @ x@` @ @X  DB|@ @ @ @O 2@~ @x @t @(p @@l @Xh @pd @` @\ @X @T @P @L @H @0D @H@ @< @, %%A(`%FX@ (@ @ DB8.@l @hh @ X @8H @P8 @( @$  x`@0 @ @ ` @ ^\ @H @` @x @ @ @ @ @ @ @@  @8 @P @h @ @ 8@ @ @ @ @ @( @@ @X @p @ @ @ @p X@px.hjnp4@ @ D@ @ `%0-@@ X7@O @7% xXApt|\@ ; @(O  ; @ ?@@F @P  h(\ @_ P\(C@ @C@ PC@ C@ C@ C@  C@8 @P 0D@t D@d 0EPs @b w@`/ wEH\h`z `~@0L @< @p8 HG@4O Gp ph^G@0 @, @( @ $ @8  @P @@h (@ @ @  @ @ @ @ @( @@ @X @p @ @ @ @ @ 8hPP(@0!!x! x x @!,  @( .h @p @ @X @ @ "H!` T%h!B @ @ @  @8 @P @h X@p @` @P @@ @0 8S@ hS@  @( S@@ S@X S@p (T@ XT@ T@ T@ T@ @!p @!` v@P  e@@ ;X@> 8`!`'T%!H!a  @!4 Pk@!2 !!@ "0 "!@, 8"!s th@H"* `" "@"( p"H""H"bfoun@"& ""v""@#$ ""v#"@(#" @##@  P#(#(#("`#@^\P#8((  he @f .e8f0Xf 2e :0i 2pi@e8e D` D  D &HDQp  F ;0nH!h x  PO 8 80 h PW 2h 4            4 ,0 7@ 6`     $ D   D <` l :$0 @ H &X      <  6  Xx *:J4 ( 8@ H`h 0p,(  B .(@qX&1 : BH X hx  HC `p" H F D@ H . F HH H   $DQ X h 4!p *    0@ !H !h   HC 4 " L H *`    $8 (` * $ * B 0X2 0:8@ x:6<*H6xB:8 2@ x , 8 < 0! <8!  X! Nh! 4! &! " @" 2H" J"4"" " *# 8# :H##'####*## #$$#$*($@$H$ P$ `$ h$p$  x$ .$ H$ $ F% FP% "% % % % $%  % & &  & 0& @& H& X& h& :x& :& & ' ' 8'H':,`' '@' ( ( (((((((( ( ( 0) @)$#X) ) )*.) )) ) 6) *.(* zX*  * * * ,* (+ :0+ p+9+ + B+ B+ <0, "p,2', :, 0-jX@---- - :- @. P.X.h. x. . . . !. B. :/ >P/ 0/@'/880 ,80 h00.0 >0 >0 :01 *p1B1 112 2 22 2 82 H2 P2HCX2 4 (4"  04 L84 J4 J4 J(5 "x5 ,525@6*H6 8x6646 ,6. 7FP7H7 87.88H868 :8899 J9`9h9p9 x9*949L96H: !:: L:8:  ; H ; 4h; 2;;  ; >< 9@< 4X<< 4< "< < >= 4H=(= =  = D =  =  >  >  >  >  > [(>0>!8> H> h> :x> L> &*? 0?8? D@? ??? >? L? 48@ "p@@ @ @ @ @ @ @ @ @ @A A 6A  HA XA [`A hA ^pA ZA 20B&*hBB BB B BB 2B C C [ C (C&*0CXChCxC CC C CCC PC D J D LpD ND E3 E@EHEPE hE 6WxE  EE EEE  TE V8F bF3FG G(G @G 6WPG  GG GGG :G GHH H 8H .HH BhH  HH HHH NH ,I 8I PI hI I I I I I I I I J  J @J `J pJJ4J&J &J K K (K;HK `K 8hK 8K K :K <0L pL L"7L0 LL.LHMPM;XMpMxMMMM M MM 8M @M p(N L.N N N N OO O N O "pO 8OO4O` P hP lpPL1P 0Q8Q@Q &HQ pQ 6Q &Q Q Q Q R R R 0R0@R%`RpR 4RR RRR R R S0(S%HSXS 2xSS SSS S S0T%(T8T 6XTT TTTT T 2T <U  @U HU;hUU 2U>UU .U V 8V 8HV V <V 6V2WPW>XW 2xWW>W >W B(X 6pXX>XXX 2X .(Y 4XY 4Y 4Y Z , ZPZ 4hZZ :Z ZlC[!;h\!\\\\\\\ \ \\ \ R\ :8] x] D]]] <] $8 ^ ,H^ x^ "9^ j^ 2 (_ 4`_ ._ &_4_(`4@` ``` 6``` @`0aHaPa Xa &ha Raa  6a (b"9@bhbpbb b 2b b"9bc8c@cHcPcXc 0`cccc c $cc;c d  d <8d0Ixd-d-ddd d e e ee e (ei: The add-in contains a storage toolbar, which contains the= chemistry formatter button. This toolbar is hidden from thex? user by setting its "enabled" property to false, so it doesn'tN,* appear in the list of available toolbars.& CustomizationContext = Templates(1), CommandBars("ChemFormat").Enabled = False Templates(1).Save> The position of the button is stored in "DocumentProperties".; These properties were initially added to the template withnfo the following statements.MacroContainer.CustomDocumentProperties.Add Type:=msoPropertyTypeString, Name:="ToolbarName", Value:="Formatting", LinkToContent:=FalseMacroContainer.CustomDocumentProperties.Add Type:=msoPropertyTypeString, Name:="ControlIndex", Value:="9", LinkToContent:=FalseAMacroContainer.Save ' They aren't accessible until it is saved.`\$ Initial location of toolbar button.]@8]@` Records AutoCorrect statuse; (If on, fancy arrow is replaced; if off, --> is replaced.) Ch]@] ]$Chemistry Formatter(# Add the Chemistry Formatter buttonA@E Start the module that controls whether or not the button is enabled.e . "/,o1 Unload the "handle button enabled" class module. "/,2."& Remove the Chemistry Formatter buttonA@o6 Adds the "Chemistry Formatter" button to the toolbar.]X]x]]]]]]]0t> 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. 8l:ChemFormatCKTSU< .!(%6.he t? Check to make sure the add-in isn't already loaded (perhaps as a different version)or$!'rd$!$!'2is  m !o l !'se Chem  Format  Word  ! 21 An installed "Chem Formatter" addin that differs1 from this addin is already installed. Exit with a message.g t$ #+/</An attempt is being made to load a second copy /of the Chemistry Formatter. The first copy is:   ,  stored in   !  The add-in trying to load is:   ,  stored in  $!  :This add-in will not be loaded, so as to prevent problems. "Chemistry Formatter Already LoadedA@o, Don't run the rest of this install routine.rro 2$(|(k kk ile B@&xk. Retrieve the previous location of the button.r, a$as ToolbarName7!2'ar ControlIndex7!2'llqX Make local copies. ofcr ' '" D'B> Validate the position in case the parent control was deleted.om P 29".> The commandbars collection doesn't contain popup commandbars.. T5 No way to find out if bar exists, other than to try.le.f (commandbars("Tools").Parent is sometimes "Microsoft Word", and sometimes the "Tools" popup control.)L  .%(.> !t !>cb  Toolbar exists and is enabled.sT'jkPdH B@t0k(k  Use defaultsame6 Can get here if user deleted button or its container.ar o j/ Place the button after the "Justify" button on the "Formatting" toolbar. Formatting''# Find the "Merge & Center" control.  .%(.( 8l{: %6.- Find the "Justify" control.um ptRegi '"d ! '"harFolkxkp* Ensure that the button position is valid. " !!d rPrev !!d '"bPk< Create the chemistry formatter button. It is stored in theb2' "ChemFormat" toolbar of this workbook.lP < " ChemFormat .%(%B@ChemFormatCKTSU " %(<Se3 Make sure the command bar containing the chemistrying); formatter icon is visible so that this add-in can be used.AllWor !l | !* (*wdFindk` kX |P tH #)17!An unexpected error has occurred:   Error number  !   !  5This occurred while adding the button to the toolbar.  #Let me know and maybe I can fix it. Chris King, cking@troyst.edu  Last Updated:  ^  "The latest version can be found at  spectrum.troyst.edu/~cking/  \A@ B@Cl Keep tryingmeoP HB Removes the toolbar button and saves the location, if it changed.]]]@ To understand what's happening here, you have to know that a> menu popup control contains a second control: a command bar.sdA The controls on the popup have as their parent that command bar,( which has as its parent the popup menu.? The command bar of a custom popup is given a distinguishingndA name when it is created, such as "Custom Popup 110993829". ThisA name isn't accessible to the user, so it uniquely identifies the popup.ou Find the button. D'B 8l:ChemFormatCKTSU< .!(%6.M r> 5!'!" Commandbar containing the button.e # Record its position and delete it. cbcB5'C@qk    ) Button was moved. Save its new location   ToolbarName7(2C  ControlIndex7(2rC@qHk@|80 #)17!An unexpected error has occurred:   Error number  !   !  9This occurred while removing the button from the toolbar.  #Let me know and maybe I can fix it. Chris King, cking@troyst.edu  Last Updated:  ^  "The latest version can be found at  spectrum.troyst.edu/~cking/  \A@_. If error occurs, exit without doing anything. o E Sends the selection to the ChemFormatRange procedure. The selectionDocuA may be a normal or block selection, cells in a table, or text in# an autoshape, comment, or textbox.bc^} Note: the name of this procedure becomes the tool tip for the button referring to it. A space is inserted before the capitalized words. Created by:meq Christopher Kingtrol" Chemistry Department# Troy State Universityn% cking@troyst.edu# phone: (334)670-3576mber< home page: http://spectrum.troyst.edu/~cking/var_Th]$" View: Print layout, normal, web.]0$# Number of characters in selection.Ne Shapes.]H$! Indicates selection was a shape.]`$+ For iterating through shapes in selection.]$* For iterating through shapes on a canvas. Block selection.]', True if status bar is originally displayed.ll]$( For iterating through lines of a block.^x]$- For enumerating the characters in selection.ndBa]$ Holds msgbox return value.ok|]' Ranges in block selection]@$4 Number of ranges (blocks of contiguous characters).]Xp-& Start & end positions of a character.]]$# Holds ranges sent to be formatted. Table.]$ Is the selection in a table?]$* For iterating through cells in selection.] Indices for lBlockRanges array.` .!b!dG|jP .(fH Determine if AutoCorrect is turned on. This is used in ChemFormatRange. to determine which type of arrows to replace. !'8 h: Determine if the selection is a shape, a block selection,+ cells in a table, or a "normal" selection.C Can't have a ShapeRange unless in Print Layout or Web Layout view. j!l!l'2 2 n 2 p5l 40 $ Format text within selected shapes.` 85r3 A canvas may contain other shapes. Look for them. 8!l t 8!v!d  < 8!vX <!x!z <!x!~A@|k <pkd 8!x!z 8!x!~A@|kk 8'6kpkh 6 ' Block selection (made using alt-mouse) A This is about 7 times slower to process than a normal selection.5l  ? The block is broken down into ranges of contiguous characters. ? To determine if characters are continguous, their starting and  ending positions are used.5'H H X+D 'F .!'  .(fh  .( .B@ .(fk @5 @!'J @!'L3 If the previous end is not the same as the current3 start, then the boundary of a contiguous range has8 been found.P J H  H F Z+D F 'F J F X+D Finding lines in block: F lines found' F &OThe Chemistry Formatter cannot handle more than 500 lines in a block selection. TYou have selected more lines than that. Only the first 500 lines will be formatted.  \$'B B   .( .(f |(d ykkk L'H @ L F Z+D * Format each line of the block separately. > FLine left to format: >'5P.N N > X$D > Z$DC@  NA@|q >! 0 Collapse the selection to the end of the block. F Z$D F Z$DC@'l Haven't found a way to make the status bar redisplay page number, etc. User just has to click in document. #  .("k % Normal selection, or cells in table. #d 4 If nothing is selected, select the whole paragraph.x#5l 7!PB@H`#k@ ; Determine if the selection is a block of cells in a table. ; If the block of cells includes parts of more than one row, 5 then the individual cells will have to be formatted. 70 Within a table.5!d 0 More than one row selected.A4 If entire rows have been selected, they will format) faster if treated as a normal selection. 7 7  7 B. Not all of the cells in the row are selected. 'Rk kk 3 Format cells in a table. This is slow to process.  9 Takes about a second per cell on an old 200 MHz Pentium. R T5 T!PA@| TY"  Normal selectiond85PA@|#5!d'4; If an entire paragraph is selected, collapse the selection$3 to an insertion point at the end of the paragraph.x7 Otherwise, the original selection remains, so that the) user can see which lines were formatted.5!d-* All or part of one paragraph is selected.5! 3" If the end-of-paragraph character3& is selected, then the whole paragraph)T3 is selected (probably).$ C@  4 C@ 7 Collapsing directly to the end moves to the next line,[8 unless the selection is at end of page. Determining if4 at end of page meant counting all characters in the# document; this seems a bit faster.P(5(01 So the user won't be typing sub or superscripts.*#5(#lhk k k k k q Selection* .(f*#| ` #)17!An unexpected error has occurred:   Error number  !   !  +This occurred while formatting a selection.  #Let me know and maybe I can fix it. Chris King, cking@troyst.edu  Last Updated:  ^  "The latest version can be found at  spectrum.troyst.edu/~cking/  \A@ld .(fK?o (F Formats text, e.g., H3O+, as a chemical formula, in which numbers andTC charges are subscripted and superscripted. Asterisks are replaced%C with "" (the centered dot). The arrow created by typing "-->" is%'%D replaced with a prettier arrow. Numbers in the form of 1.43E-7 arel replaced with 1.43 x 10-7.T ($]' Number of characters in range]'# Character position of end of range%P]'1 Holds selected text for sub/supscript processing]' Character position counter)]'* Start & End of range, so it can be reset.]] '& Stores two characters to be replaced.@']8' Character at current position#]P' Ascii number of that character]h'7 Indicates a character is in a region to be subscripted0]'9 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 ] ]8]P]h'7 Second previous character before the current characterX]]] 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"` !!d'  G|jXE Some countries use a comma instead of a period as the decimal point.d  .%$' @B If just 1 character is selected, there are only two things to do.- Replace asterisk character with centered dot| e, (Find doesn't work on a 1-character range.) e e !d* e e (d e 8 Move insertion point after inserted character, and end. e  h%'> e|+ Nothing else to do, if just one character.\ ekH. Replace the arrow made by typing --> with the e prettier Symbol font arrow. e, e !'#8 Find doesn't work on a 1-character range, so extend theol- selection by one character before searching.dex  %'>1  ! C@^u616649d- The unicode number of the arrow in WingdingsBC99999 9 C@q !!k  An arrow was found.yz{ !  4 The arrow is the selected character, so replace it, E and exit. (The alternative is that the 2nd character is the arrow.)Symbol B@kk= The rest of this procedure requires more than one character,P  so quit.|@k87 If get here, then more than one character is selected.E **************************** Replace Arrows ************************ters. Replace the arrow made by typing --> with the prettier symbol font arrow.'> !' > !' !C@99999 9   / AutoReplace is active; replace Wingding arrow.es^u616649d_>C@5W find.replacement can't be used because it causes the whole document to be repaginated.erS Repagination took 16 seconds on a 90,000 character document on a 200 MHz computer.$, The InsertSymbol method doesn't repaginate.'Symbol B@   B@>d0=x(=k ==d= , AutoReplace isn't active, so replace "-->".nces o-->9dhara_<C@5Symbol B@  '>  '   B@B@"dH<x@<k8<0<k(<q <J ***************************** Replace * with ************************** !d's **D Tables have an end-of-cell marker that is counted as two characters E by the InStr function, but as one character in a range.characters(N)\G evaluation. The solution used here is to replace both characters with 4 a space. $$' 4'>_: >  '>case l >  9  > $   > $'pt > '>d:x:k::N Likewise, in Word XP, inline textboxes and shapes are represented by a singleor pO character in a range.characters(N) evaluation, but that character takes up two[ character positions when converted to text. The same approach as used above will be used.pace$$'bol, o'>_8 >  '>ast ch > he s  > $   > $' i > '>ttd@8x88k08(83 Replace all occurrances of asterisk character with centered dot. '>_7 > * '> > a > %B@"  > %B@x6 > '>d@7x87k07(7G **************************** Subscript Numbers *********************** s& Here are some ascii codes used below.nt c 9 "tab"r ")"  11 "linefeed" 13 "carriage return"  32 " " 40 "(" 41 ")" 43 "+" 44 "," 45 "-" 46 "." 47 "/" 48-57 digits 0-9 65-90 uppercase letters 97-122 lowercase letters 250 "" Subscript numbers > ****  >$$' cha / :    b Character is a digit or period.   $ Character is a digit.\ > %!(dx4 1 Subscript a period in a subscript region only if 2 it is not followed by a space or end-of-paragraph  symbol, or tab, 3 and it is not the last character in the selection.a 5 Also, don't subscript if it is followed by a letter,2  as in www.chris.com is -; >  .  > $$'st cha     .   A Z a z ) ] F'd2 > %!(kh2d`2'kP2kH2k@2k82d02 1 The next character will be in a subscript region 9 only if the current character is a letter or ")" or "]".i UPPERCASE letters lowercase ) ] A Z a z ) ]'d0'k0k0 >evioH ************************ Superscript Charges **************************/ Superscript + & - charges. previ2 To get here, there must be at least 2 characters. > /  >$$'ecid        R) space, carriage return, tab, or linefeed' f UPPERCASE letters lowercase ) ] the A Z a z ) ]eript'k.   43 is +; 45 is -; 32 is space.) + - / First characterize the surrounding characters.in'* Initialize all to False.ce'''''  Following charactera numb >  3 or  > $'E $'ip 0 :  >- Following character is a number from 1 to 9.us n'  e'k,k,  Previous character( > scri  > $'d by $' / : 3-, an, Previous character is a number from 0 to 9. '  e 'k, Second previous character > %  > $'+ T $'s / : 0 2nd previous character is a number from 0 to 9. I'  ecter'k(+k +k+ , Now decide which characters to superscript.- t 6 Don't do anything if preceeding character is a blank.xamp  Superscript the +/- sign > %!( , Superscript a digit following the +/- sign.rt or  > %!(d)( Don't superscript a number following ). w ) ) ( 2 Following character is not a number, so check the preceeding character. 6 Superscript preceeding character if it is numeric and 0 it is preceeded by a number or it is 3 or less.ca  0E Don't superscipt a zero.   > %!(+ Superscript if previous number is a 1 or 2( 1 2e > %!(8 Superscript a 3 if it is not preceeded by O. This will**< handle NO3- and HCO3-, and CH3+. (Can't win all the time.)3 R/ 3 O 3 Oe > %!(rek&d&+ The previous character is not a space, andpital ( the following character is not numeric.. If the previous character is not numberic and is - 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.  . Don't do anything if at start or end of line.cter >  > 4Superscript if not followed by an end of word token."E". ( , . : ; ? ! tab carriage returnec ( , . : ; ? !     > %!('kP#kH#k@#k8#k0#k(#k #k#k# > preceL ***************************** Exponential Notation ************************3 Replace any entries like 1.45E-7 with 1.45 x 10-7.imal i > At least 3 characters are required to hold, for example, 4E7. '_" 5 Look for capital E, beginning from end of selection.ns w $E  $ 'k % Ignore if "E" is 1st or last letter.rmat       $$'( d Digits + -Symb / :  + -  . Character after "E" is a digit, +, or - sign.h( Therefore, a numeric field follows "E". Find the length of that field.'% Must contain at least one character.hing >    >$$'ons) Digitsck to / :  alrea/ Still in numberic field; check next character.) >  'd: Not a valid number field, so last digit was end of field. >  'm Foyk >1 f  - +ExK Don't do anything with, e.g., 2e- (electrons) or 3e+ (possibly positrons).( d0 A numberic field follows the "E". Determine if one preceeds it.   $$'!$' / : Chem'  eForm, Check that digit before decimal is numeric.f     $$'empt i / : \'d'kd) The word begins with "+E", so ignore it.'k@k8  Exponent detected; format it.Th >     > %!( > st Insert " X 10"6 For the "X", use the symbol font multiplication sign.adedSymbol  %B@ 10  %B@"   %B@kkkdxkkok|]P XP'Bersion OT97'BOT2000'B .!6$'B'J .!6  .%'J OT OT .!6$, Don't run the rest of this install routine.cf]8 nfSf11'BB@u     9This version of the Chemistry Formatter requires Word XP. 'You are currently using Microsoft Word  B.   <Versions of the Chemistry Formatter for Word 97, Word 2000,  )and Mac versions of Word are available at  %spectrum.troyst.edu/~cking/ChemFormat $Wrong Version of Chemistry FormatterA@Q Check the version of Word. If incorrect, inform the user, and unload the addin.eQ Curiously, when installed on the wrong version of Word, this part of the code> runs, even if other procedures in the addin won't compile.partg]$ March 1, 2003this p@i .!6$ Pi4 Following doesn't work on earlier versions of Word.runs, +AddIns(Templates(1).Name).Installed = Falsee.parthAttribute VB_Name = "ChemistryFormat" ' The add-in contains a storage toolbar, whichBthJexc fter ton.R Yis@ hidden frHom ?us0y setting its "enabled" propertyD false, so# doesn'tappear R l of avai&l"?s. CulmizationCwextTemplat es(1)ommandBars().EOFI .Sav1 posi8MSed_"Docu mentPzies"Z se ` were(allyހ to td withfollowyWst9C('`MacroA}e r.GO".Add Type:=mTsoD(ySng, :="TËA", Val:u "NAxLinkT;:=Q?#@' #5rolIndexH#9)!r'&Zre accessible untils}dl Op{ExpliciDefInt@ A-Z eIno locBN Privk msU As> 89Records Aut`,rrectyatus(If on,incHrowPre_c ed; iff, --> .bibRTag BeanPub Class1New Butfrdons@APP_NAM.EGk DGer #LAST_UPDATEDMar`1, 2003fSub#Exec(@;A[dgD1 '0art!bnmodu Athat`1se r or no~$@E Set&.App(B End + itUnload"h 5c2 4No|th"@ ' Remov` &@?kD[&+' @,` @D2Dim sDecimalPeVersE cbcC&cCsThismnB!|ege\ 2-Ics`insͲ i bFoundP&as rOn Err(GoT>os 2q%0(' ick"v4`tWgD|@Cin`ED,ϐg~{, &`P'in&' wriouslyAtk0konRwrol, UpA6:codcubruns, e>v@K6PLuresP  won'9mpileW 0 i(6.!) < 10^P  %= InStr(2, UI !!rn= 112;@#s.@11 PI0O1@XPOݒ9?5V0_R8_U97>ES%MsgBox ": h&1%Kr requi1$/ XP." & vbC r`_{ "YoDu @7 cuvntusMisoft R!Fx& "P5X"mTsu r#97,q, N ;b ƒ$vbTab"sp@+rum.troyst.e@du/~ck@/ | ]vbOKOnaA"W@5+>Ǐ' D<@;">tBE rou঴>p'@}ESPArkА l~ipȤ!B"\s(JZ).I@L = 0Exit'{@|If#' G'׀alrea$dy es , d+itP"(R+cls up4W`1ctTaX du,`,b hap@Rc8ompi ' crashed@fiP Z˘;0a% d haQdiffʀtagav=S7ms.Fo: #(Vl, ID:= Tag`ȇ'CKTSU"cS S^po make ^se&dqi eo( a0&%\=> %r ؅dd?&o(a( 57 E}ach ad In AddInsH If.Ltalled ThenxsinName =V BInSt r(1, Z, "Chem") > 0 An$5 $Format&1 LWord%dex <> nThisI.n .'J i,ns}W Gter"vdin that differ ' fromis@lready.. Exit with"a message.MsgBox "An attempt 3being made to loa secocopy " & vbCr_ "of0e listryA.O first is: & ",!estorin% ad.Path>a@9add-A|ryUET;Bo;@7"@AFT@lates(1)2>U#will not beIeduo asKprevent problems.",`KOKOnly}lG Al`"L Sed"1P' Don't ruAme reLQs routinW3c(})ș= Falseq(SubnEgIfn NextecbcButton.Delet(' Retri`*Bo+ious.cationZ drb# bW =@msToolbar`.Cu gmDocum5Properti C"AS").ValuF#mnControl;J"' MakAHcalsBarc= F"# 9cizB#!.= Nl%"d' id@b#+osi*@{cas@he paraY bw@\zdb5df""*'mmand.s`c does!Za a`popup# 6B' waykfiN\ if  exis, oPtheracoF @(co&(5;s`2PCgsometi "Microsoft rt, @  .) On Errojr`+s% 1/S eab#Appl2i+.C s(.Numzb =XGoToq5"eP pcb.Ena Iߋ 1re bFound= Tr?1<{E Clear ? <: H#' U*de fault' ZCP g !e"uVst+ B it)nt'er#9pNop] ' 0Plac1afP4"JEifyv"6'T`s" tv4= "cxu' F/(Mergep{C99&0V&mev&X*"dL I(Type:=m so', ID:=123)@ OF] 2)%Is@>th.N%O13%E%e+ 1@Dk$Ensu^rЬDpQs` valiO[> ts=upZQ RD -t'cPÃfQ( Ir'%6(3t>workbook$m_JdRJ)) aC":=cb, BeP `#" ().Tag(CKTSUsecBa&ain$1$ivisiQ^dcDp0DG0 cQ0mso@Pl+DV-'kT ^: unexpectpehh{occurƒ&vbTab0E"bW ngh_eADescrip}Q @ whilega*S`űURm "L^`knowrkmayI fix it.+)p%r`K`", ckinܸg@troyst.edu" & vbCr0_  "Last Updated: sLAST_UPDATEDtThe lnversion can be found at xTabLyspe@ctrum./~cking/",OKOnly, sAPP_NAMEErr. Clear Resume Next ' Keep tryB E@Sub PrivR  ButtonRemove() ' s tftoo@lbar b Ba savelocatq, if it changed. D@im cbc- As CommBar sT/1StrRnC4onlFTo t?what's happen here , you ve to know!_at a!menu popup cains a sedEm|aB+ @>3' uDs tAFhC aCir @parentCc C<,!whicVh@(sKs e?&)<^H of@*customD is giveBndistBuishnawh@e@ cre5{d@u!+"CPBE110993829". ;isisn'@QccessiblCBWA?user@o}uniquely id@?ifiI4@4 On or GoO@tCC ¯' Fi@+iz= NormalTemfpSe@ƞ=@ Appli.Ps. L Fp(Type:=m soc, ID:=1, Tag:="ChemFtCKTSU"3 g`If Is72HnWi mOr  j"' wSAd QSkits new %B(Macr4!e# .EDocntPr opert S("d*").Value x$C%E'E^x`t (b:BMsgBox "Anexed (errih&ocpcurrըFZvbT"onumber.NDescripH7"Th@me r+U fr|.y"LyBmayIfixWAYtrK@, B#& fcu' 7 s, e%w F@out doanyth`?A(&xPubQbL`dr"yCMterÀSend~s@c" v 'PRq proRcreBdeul``aa n[ +b =kW`ellq!mtaf,Qt^iB'L autoshapqfFbox 'VeP| bpsv p4!( tipr 18ref@it A spacS ! ot 8befor@qhe(pitPaliz`wWsECw by<'&7Ch*top= q*a6 DettNT0 StUnPty^0phona(334)670-3576^Dho8paghttp://_+V+MViewQu y' 0plat,", w eblCharCt1Lon>gL0racp,W&' S$AbBШe;M`^#70qjǰ shpA+@/i 0 through ,N OnCanv ^oRB6d b #usWasDisy ,r@r@sp&us1 ^riginal TNy 'pF[erlifn`a Av2Varia "`m 9"/ n4nlt  ' HolOmsgE return vlOs(402, 1 2) )QwN#n3- ׀z0r(fBiguo0.>) ^, lCant r(41ta& ^$EU4 rR@- =T s[|0Tma>tT &_bInPr`p9Q[9ic?s cC`e Cell ' For iterating through cs in selection. Const nSTART = 1, nEND2 ' Indices flBlockRang array?On ErrGoTo Han0dler]If ApplicsDocuments.CountAh0 TheExit Sub6 3ScreenUpd= FalsBe(' Devm ine i5ut oCorrq is turned: < 3usCChemm$atj V' to d(which type Hof zow)o replace#mbRTejxhAA. WWith S <1ctheԁda shape, a bć,B.ya tabl@ @fa "normamL@45mso@fA >@ Itemj> j On I@hp. `E._Frame.Has`5o}@$p a s End IfTNa=@*E EBOd.!_h& bb= Tr~u` eNot 9' b (made usalt-m*o)'abAa7 tims lowerpro@͠han# FcOAedbrok̀vnᠽrCແvigu` characm G]e" ,eitarbh"1' e@potsiasb!ԬlLast4= y(A|})Q-nR5%x1bStatusBar@WasDisny0R ]|s+#O+?d ?<sRefresh ?4%4&VvC4hr"dC%lCupnt0 rq1.!n'Q1( prevniq-&n= h s0[ kcOl s&,n ."/,/6s/+ 0e36 .ps5)"FRlBb: " & - &Cf d"  q)> 40 RnResulQ&MsgBox("p qjist+OA"PY@` more0 Z5 >.A vbC:r _ "Y|ouc3ʐBct a@tpOnly`e fir˷4wi@bptted.", vb OK`, sAPP_NAMEi( anp) |QTaT_5PPEVEOx BFB== U?KqMk_8V8PB?Qճ|ea0A%LOp@tel#S  Np61 S`tep -Bz>L= leftQp5D>N Set rRP~! A .SetRange Start:=lBlockHs(N, nSTART), EndtEND) ChemFormarRngNR With Next N ' Collapse the selection toend of b. >nvCountwhv1tusBar = "" ' Haven't f,d a wayWmakIbta br@edisplpanumber, etc. User jus t has click in documentvIf Not b!HWasD/ed` ThenK.AppaT. 3`False nIhf H'@|lg, or cells+tablJe*EN' /nothing ibsDed,DBxwhole par@agraphO?.TypeawdSIIP>.Ps(1).B@;M' Determine ißǦ9/a Aa BB@> cluHdes;tsmoran o@row,K*'I@individualDawillHvo be`SAtted(InfCxl(wdWtInTA8)B) \aP` .Rows.bk > 1#@C' MF>,[` ^i@ scb(een,y "# fas 7Q6rea@ ka naHX#aOflumnNBx) _ - .mrt+&<MaximdumCOf sw55a?rhe ) a*WA&bd@kTrul%e$' #'%L Gj!@slowapr ocess4' Ts abouBt@seco pg gld 200 MHz PJum< Each cC In .s>MB#b*)oM_@ lCharͳ:= ac02; Z9&Y[c/{0E>pKoainCo}point== (~_ A' O@Trwise@ahiginPwYrema@0ea) uqwc see whiPlp^s we2ES@AgeO=O' A18r]\Q\ q.aLPL8vbCrU2d-of-c_'K3fxOo (@=byfy)8v0ԠDÐ`:=wd5T.MoveR`ight ,/- 1fቚdlB m2n!# zA' unlK-)M@).@er`6' { mea4c_F #h/\'֥; WeemU bi Gs.Fo0SuVscriptk* @hS5wFo`typ subs]P5b P3h( ' fRɴScrUpd = Ss ExpSubQUErrorHa@ndler:"MsgBox "Abn "expΠeq `ccurPà:" & ?&vb`p"r .o`cyADespZ"Th!o1RpQ7&DP. "Let* kn0}P may@!I Wfix it֐P"ChrK, ck`@troyst.eduwBS2ed: sLAST_UPDATED' P lТversQ dtsrp /~ /",pOKOnlyiAPP_N`AME $$ ($Pub  L(ByjVal rngSelection As Range) ' Formats text, e.g., H3O+, as a che(micfNula, in which numb$erHndchargere subscripted and&p). terisk-replaceEwith "" (the cen(DPdot)7Tarrow crea]by typing "-->" isQ Na prettier $N]f3n of 1.43E-7e# x 10-7. DimH lCzacRCountLoF ' 6/sr„#InitialEύ! &' 5 poswYe&sTEStr"F' Holds sX An0/supoNocess@)N)cAGerMRtarL' S& D8, so it can be rese>tcbO+sFFiCTBSto HtwoarhtoCæF|nAsc/bL=I@a*ur~rmC& b'pciitNhbSRegBooleHD' IndxtsgePa(#hw wT  %Bsa*FollowAV``$6* 1a3 U%c+Fk+' +JbF7 6ckg,' True f43,Cic*J Sp` @?] a s'Prev! N' sreceedA-(A As -qf2nd~e co@v viousUbee > 7o' 1E5 `Q^5lPosEg!#M' `fEmc uAUDec o`"' Move!er af0 TD`#N = .%, 1 #2o el"0rdo^Bon%g^aIfd'@' uKmade ׫E'wSymbole03El 3`//afKQ zpYsearc'Q`  Wѿ a E 0.Cpr3t0.%&^u61664"At;unicoH` row# ngqpp3Qward0#axIMatchCa 0= Fa!Wh9WoAlvlQ s OAW0ildc0 .Wrapwd pYExecut r%9i!.F@Qd9Pgnwf1<= )>@0a@30iVLHB(D, "1e](  al@WaBA@kQN3>c0J'InsF47F@ont:="",%:=174, T&:=A@0 tý $prdu\rehquiqmqxn@WFF'1ѰiQoZnd If ' get here, then more$an one character is sele,d. ' * Replace ArrxowsV- a1 made by typing --> wi th3prettisymbol font<AN = 1+lRngStart r bion. E=  W= Find 4.Clear FormaHngC ward;True Matc hCase Fals WholeWoAll7s ildc;!Wrapwd!/Stop$If mbDaText T@8' A8utoi@ivPe; ryW@id_AjoC` .= "^u6166d4"Do ExecutD'.FougL%(' fc.D"mecan't b@e usedcBa it s A wY doc2u to aginateF'A@ took 16conds@ a 900,000Hon2MHz chomp9r J'^ InsertSCmethod*es5(Oʨ "F:="",'number:=174, unicode:= O& SetRange k,BfEH\x1?@bLogTMRA#RP, soS"@" %QQQ/_B://!-a$=- - 2KhlCeCf-; ;B j;{!ԛ**Õxsdja@oables have end-of-cHellrkthhat!c!+`aiwois$ AhexStr funct@, bu`A !rAi.s(N)D evaHlua. solu!! bo G # a sppy1sa``Chr(13) & 7sW:1In (N@6`A#ZN >t 0 n2Left(, NE+1Q" "Mid+ 26qN +}|'ED&V&Likewisin RvXP, inliEtobox a)shapXresedy\snlA'p<) GC r$& takup twC#qIposis0kfva  e!amP+ppro0ach )oabo,wi ,pBy21Cr0@ Pd5d ŋaoccur`c@ofiskcabrdot M,=>"*^vbq2Care6-_Iv\@.|Af"iOBDte wd&,G4 5t G 5[ Subscript NoH`eC0|,sciiВd#1lowS' 9A"tab0' 11 47 APT< 58)P Or =D@ecimalc' ha or Yio4b RegṿP>dL2!'F77Q.= 3 7@'H3ae s4rConly iS'0notPl!"@Rk& or end-of-paragraph ' symbolB,tab, xand it is not the last chcter in*selection. Also, don't subscripPfVfollowed by a letTsgwww.chri`s.com fIf N < lCCount ThennAs"c = (Mid(sText,"+ 1, 1))3<> 032 A 13i 46 9Le(A)>= 65= 90) Or 97122 aF= 419&3"#bSmRegxLFalseG E@rngSks(N).`Font.@Tru@]IfQ })2E  $'A[ nwilPl bear[H9' only ifBcurr6esFс")"]"r1'` UPPERCASEdosat`rcase)=]g?[?[<= ?[d1[@L/HG l>GN!=N ' * S0uperdbgeRs***'+ & -J@=Mo get here,Fre mfuMat>A2UPsFNo1 ToE9ȇͧJ}ɥ=`h` 9=l1 Jpac carriage return@ \linefeed 7&+abaaFaALaar_^`0+- c' 43т+; 45-;Qs&C ` { ' FirizePsP~ding,PbF†0!6Numeric0l ' IniPtial1aXto I ^Sa 5x'PrevmbU0#b2nd ,+ sa1PyDo 2d> 48֏< 58)}*sPRatnumbfrom 1 9 C_%S%Let?Q2.aru+; ? .$iousS>_ 2!-$$fB`&' A Ha i0ov9tB no>_Q~PecopE3Tm$2/sB2|PH}u)'  /yU`3  9;: o ' Now decide which characters to supHcript.  ' Don't do anything if preceed is a blank If Not bPrevCSpace Then lw' S the +/- sig*rngSelection.V(N).Font. H= TruemLbFollowd!Numer icMOa digit f! X Z + 1'\Elsf/@numberS)&')NMNnAscK2ndu <> 41M ' FZGna (, so@eckRQB4B f @q!qandC ed byGXor3 lessU%AAnd DUT8T v@zero@>g CwT-Tkzvious>1A&2. A^  $= 49 Or&= 50P_# Ka 3dJ[EO. Mwill' hPle NO3-d HC ,BCH3+(CaC alltime.rv%3pCO2"V/1 X7922˿2)EjIf4U}'Usآ1W$'B2x' ^`Htז~a $ vcv-:+`4es(nbeYed xF0Rexample, n-butanol/(Exceps: K+(aq), "K+,",!, etc(W)B+)+Ylat st(arte(of line @ `N < l1["Count N > Ov'Io W1+s($kn  wordkeno (|,K;6?!tab carriage retu~r0,di'0wB4Q6589٤633130?\pt = FaO b-Regп`~/+so > Next N 0 ' * ExponentialaT/l' Repla`ABtriesKke 1.45E-@7 with x 10-7C0K>=' At least 6qr7quir@J`hold,`dr fb4EtlpPosExDo' LookcapitE, b#nn0fromQsVInStrRev(UCase(sT@1hEh3AaIgno PX"tE"1letPW ^OcaF= Й(Mid , lPjosE + 1, 1)) ' ` ,DigitVst.+X- If (nAscNumFollowing > 47 And < @58) Or= 435 Th en xO' Character af"E" i s a dx, +, or - `sign.+r@efore,numeric f@ield ffsN )Fipthe length of that6nLen = 1' Must contain leaone cj"JFgNlPC2 To lACount*b@j(Mid(sTe`xt, N' N~ |oStill +A`bG`;Aecxk n)DWN{G*ElseA' Notvali@um"s8, sYAg was e@|Ši $1% ExitN w-@IfNNA#N @2MAqkt n5Vq)Sn' Don't do anyth~with, e.g., 2e- (electrons)p3e+ (possibly ic'3.yA KFvrw H Demiji'!npreceeds it9gPrevOhcq-2k @b`B⌠FatPh ij Tru],aD =BDecima~l?rbbcd 2!y)``&> qC_/j2 __+,Yj CEs?%R' word begins ; "+E"Mq0p/( ?9 e @H/ceѐiExp`;n@H=d;?rmPt7u 5[' Insert " X 10"'qb!Іe "Xusesymbolmultiplicat X s(:). S:="X:=180, unicode<:=v__tAR(" W"O+o >_>|DoaKLoope  Sub __SRP_20__SRP_3 =ButtonEnabler :__SRP_6F) kzkzI DGlG  0GQ [lH@l Hl' l TH (Il  l THQ [hH# h H lJlR * h H PJQ[ K)  hH1# l H lJlR /* l H PJQ[ K)  lH!pr krB DGl ,Glq$l$0p*$ $  kpf kf> $    $    $    $     `GQ [TrTAL"q 5TAM"q5 l l$l$k*0 k*p*l k*0,Nk*#*#O*#$ 2 k*@'d':6NP*#Q*F^pR/6dkRkf $    $   lq$ Ts\lk*0k*dk`k#Rkd#*#$ 2  GQ  l\.kd0kd0\ Sl K c\ de`.k*0k*0 8G/$  kf $   @ DGl(9  xG T U |S)   G5'  G Vl X G G(dL GLg6dLpk$  pGQ [84W!  WQ [ K 4W>  GQ [ K!  `G Xlqt '  xG Tl <8  `G (X Sl0/) : <G5.'lti G6  <G xY   <G pY c $    0  1$ 0 ,1'd':6N7*#*#8*#l#0*#,*#(*# l$*#*#*#Z*#*# *#:*#*#;*#*#*#<*#=*#*#*#>*#*#*#?*F 240,( $ ) 6d $    ,|\840Thl#0,($   dL<C< l x!(,x XS, Xl(qt,lt;8,$ ,  [p6/,5ltcx Sl\0/ ]x S9((,$ <, XGl(pj,6(x 4Sl(qp(((x Sl(pj6,x 4SQ,  ^ _ ^  ,^  H^  `^  @^  P^ ^[>'@'`'''''' '@'`''''' ^6`@ `@c!>,x 4S, 8^k>,^(x 4Sl(lp\*'f:`Nx S6pj(x ,Sl(qd(x 4Sl(q`,x 4SQ,8 8 ^ 8 ,^ 8 H^ 8 `^ 8 @^ 8 P^8 ^   _8 ^[>'@'`'''''' '@'`'''''8 ^6`@ `@>8 8^k>*'f:`Nx S6l`ldx S a8 ^[>'@'`'''''' '@'`'''''8 ^6`@ `@>8 8^k>*'f:`Nx S6l`q`ltqtl`ldx Sc8x S>1l3  b b`1\6pjkjlll\pj kjWkjlM@  :c'kjlM@ d`1l6  kjpj3 b brU~| k  y !  1 I i a y )IQ !qa 1 Iq Qi!YaA) q !)!Q!y!!!!"IA"a"y"" $Y%&11'Y''''9# ()(((!)Q))a*)*A+)a#)+ ,l4 &x$ Qx[t$ $t4$ xth4c=[x$ $x c=  4$ x* 0 K1HL$ L lH j /HLdHL$ L >HF$4D$ D 4`1x)LD64$HL$ L lH jt /HL o iCtT o  CtT o   CtT o $CtT.HL$ L lH j1t/HL'':N$$*#H*#lt*#*#*#*#*#*#*#*#*#*F4 2H64$Q'%:%(%%DL$ L D Dl=p)LD lpcW;HD(4L$ L 0D >H1l)LD54nHD(4L$ L 0D >HF$$  0 ,lpj)LD64$!L$ QL[dI~d 4k~:Hd (>H1`Ol` l`! l`"8d ,lkj6d 0LD(4L$ L 0D ,',':#N$*#H%*#*#&*#l`*#'*#*#(*#*#&*#l*#x*#t*#p)*#l*#h&*#dll*#`'*#\*#X(*#T*#P&*#HlL*#D*#@*#<**F$ 26Hxtplhd`\XTPHLD@<)LD6 4$,4DjM@L$ L 0D 8)LD d'%p +,D(4L$ L 0QD(L547:,%L( PL4A$-`L64$6:.%L( PL4A$-UL64$c( C\ pZ$L$ PQL[D$ D l\/=K:l\F%DL$ L D HQT)LD$ 0LL 1lLK~T 2k~pR 0LLHLK kR3C\:l\F%DL$ L D HQT)LD4L'%'%'%({%%T 2lL=pL lpcy pZp +lpZ,kZLT 2L (4lL(LT 2L (4lpZLqkZD%lTo%(%:5%DL$ L D H 2 ,4 +) LD1DkZD%LT 2L ,4D +)LDT 2l~T 2k~ T 2 0LL 1 0DD ,1'':6N$$7*#H*#8*#l#*#*#*#l*#*#*#9*#x*#t*#p:*#l*#h;*#d*#`*#\<*#X=*#T*#P*#L>*#H*#D*#@?*F4 24Hxtplhd`\XTPLHD@)LD64$ 0LLHL l0 P8 (plTx\`dt&Hxtplhd`\XTPLHD@<LD4$,WCxKh$l$ PQl[h$ hQ$'(%:8%(H%X%hl$ l h Dl$=x)lh$ lxc lx !l +l 2>1tl +lpr'X% +c lt=krcl$ Ql!ltF8%:X,%@C-5!krD8%:X.%@C-5 Ac 0ll 1 0hh ,1'p':X6N7*#*#8*#l#*#*#*#l*#*#*#B*#*#*#:*#*#;*#*#*#<*#=*#*#*#>*#*#*#?*F 24)lh6pc 4 tx!lh$pC Kl9 $  , Cl) C $   & $ X @Dk   $ <Q 4 $ 8 E (Flpz`1\6pjkjlll\pj kjfWkjlM@  :c'kjlM@ d`1l6  kjpjmtpjkjll\pj kj.]4kj,x XS, 8X4 S),4B((4kj,x XS, 8X4 S),46 kjpj$+}jltc0! 4(kjlM@ d [pZ/6kZ/kZ:kZk6kV kZk6;,4kj,x XS, 8X4 <S, pY),4, kjlt7(kjlM@ d [pZ/6 kZ kZ kZ.kZ .kZAkZZkZakZzkZ)kZ]zpV;,4kj,x XS, 8X4 <S, pY),4,pV .kZAkZZkZakZzkZ)kZ] pV pV jd0<jltc("4(kjlM@ d [pZ/6 kZ kZ kZ kZ  pT .kZAkZZkZakZzkZ)kZ] pTkTkZ+kZ-pNpLpFpDp>p< kjlt 0(kjlM@ d`R6%R3# [p>lRGk>pP/kP0kP: pN kP  pL kj 0(kjlM@ d`J6%J3# [p>lJGk>pH/kH/kH: pF- kH - pD kj 0(kjlM@ d`B6%B3# [p>lBGk>p@/k@/k@: p> k@  p< kD;,4kj,x XS, 8X4 <S, xY),4,kNP >,4kj,x XS, 8X4 <S, xY),4, k@)kFkH0] k> >,4kj,x XS, 8X4 <S, xY),4,X kH1kH2 >,4kj,x XS, 8X4 <S, xY),4,X kH3k@OX >,4kj,x XS, 8X4 <S, xY),4, kFkL kjltkjCkP(kP,kP.kP:kP;kP?kP!kP kP ;,4kj,x XS, 8X4 <S, xY),4,pT jd(2 ltltq88lM@ el8f^gq8/5l8l8lt9(l8lM@ d [pP/6 kP/kP:kP+kP-p4l8jltc$|4(kjlM@ d [pX/6kX/kX:Xkjl8p4pkjl8p4| jd$k4kP-kP+9(l8lM@ d [pH/6p2kH/kH:p2~ kHk6~l8s9(l8lM@ d [pH/6kH/kH:ep2np2|p2k2l8jl8k4c ;,4kj,x XS, 8X4 <S, xY),4, jd I'c:`N4l8,x XS, 8X4 S),46-h4l8,x XS, 8X4 S),4-c4l8,x XS, 8X4 S),4:\8 8l\xX,4,`@ `@RrU $`$`$`$`$!`,I`anrU  y  !#aaq) Q y   'Vd0'V, Determine if an embedded object was opened.       It was, so enable its button. 8l:ChemFormatCKTSU< .!!(%6.( ( ((>k0k(k X V: Look everywhere for the menu item, in case user moved it. 8l:ChemFormatCKTSU< .!(%6.2, Don't try to enable it if it doesn't exist. 2% V 2(> V'Xk k ' '|Ro0H Initialize counters such that an embeded document would not be spotted. .!b!d' b!d'ass D'B* Needed when addin is loaded.'XF This assumes the button was initially enabled on the storage toolbar.A@(oAttribute VB_Name = "ButtonEnabl er" Bas0{FCFB3D2A-A0FA-1068-A738-08002B3371B5} |Global!SpacFalse dCreat~PredeclaId#@ExposeTemplateDerivCus tomiz E' This module controls whether or not  Chemistry FormattC ' !ed. O@ption [licit DefInt A-Z ' zviou@s numb4f open documents & windows(Plp mnDocCount! As *eger Win)Y1sTooPlbarSnpg @JDAIaini@J(CP @ ')dex E@qiFof  @IAZpopup ?ubîd"bB ean"Es>tEhF#Cub@^ WithEvqSAppaA! .Var@HelpID-1jESub _`hChange() 9C# End M Dim cbcC(CommandBar Eded] n? CaG.,d,%OXrr 3GoTo EAH B3' De`mine how yVBiDZ: %' Niso easy, bectauec_ inclu@c.c`utn't have a =a7>r.e8s.eb &=GFoIf > 0en`'`= Tru@E@ğ'if Z object wasea@T쁠+ 1 AO_%m‡Thgg tb, 3 ij`CSet!W RK,Act`-,Zs.F)` (Type:=mso], ID:=1, Ta0g:="afCKTSU"cpC$LjIsOha.Cu&: A{|If+Hm?d <> @' Look everyre fm`/em,@_ cdrit[@$1jDs3 oRomo0,o8qt=# `-i9esexs  E @8U=??\4= Cu _x;4_R:T1a Class_In qalizdr0T~ers sucrh@atfB`P wouldrbe spoC l_PXPBP v!tQa:extHNAlS!zNedn@ addinAloaNS Yq6!{P vsRGPtially 2prage tv(yXT4xd?<*\R1*#17c$*\Rffff*2X3fb4b167*\R3*#92*\R3*#50*\R3*D  `@H  A EyO< , $ K4`dh$ h ,d l`pp)hd%`h$ 0h l`prh krupnpnkp4kr6^'%:,%(<%L%\dh$ h 4d 0\ D l= t)hd\ ltc t >knQ\'%:,%(<%L%dh$ h d D l\= x)hd\ lxc knx kn> kp4 kr6 8d,txhd\7ptx$ x ,t lp4)xt(px$ 0x lp6x$x$ PQx[tL (u {>;P GT*]U*=h8+3q RJDs?K=jx RJDs?K=j GT*]UMED @SS S`. >"LPLLLLLLP @ 3x%% %*-@@b4@b06@BX<@ Z`H|k( (0`k,-- )t`r`p`Vn % @`pk0B PX00(%`@($ ) e(bDBX(2.b8X@h @d @` n@x\ em@0L t@H< @`, or@ o @ Hx0.bDBX(@`x @t @p HP0XT4xd?<*\R1*#17c$*\Rffff*2X3fb4b167*\R3*#92*\R3*#50*\R3*#51*\R3*#4d*\R1*#c6*\R3*#30*\R1*#d1*\R1*#c5*\R1*#c0*\R1*#c1*\R1*#17b*\R1*#c0DHJ J P hp 4x "*>,X   " "  4 >  0`4 %  2& $8 H^`      @DQ0 2x          " N7h (x,$R (C This module controls whether or not the Chemistry Formatter button"1 is enabled.gCHRI\- Previous number of open documents & windows.]@]@ Chemistry Formatter buttonhe lis]@0 Toolbar containing button.]@(/ Index position of button on bar or popup menu.]@X Enabled state of the button.] İ2PA@(oP]]]]]R. Determine how many windows contain documents.7 Not so easy, because embeded documents are included in* documents.count, but don't have a window. .!b!d' b!d'$ t >, $  xt@ DH1rU T$`($`,$9`0  @@nu0* pHdChemFormatWDXPkLSub- &__SRP_7 3_VBA_PROJECT)dir7y__SRP_0 LastbhvbCr$Collapseu Direction&wdCollapseStart| MoveRight wdCharacterFontU Superscript SubscriptVMsgBoxRvbTabc9ErroNumber- Description vbOKOnly rngSelectionlCharacterCount  lInitialEndsText lRngStartX1lRngEndKnAscChar{nAscNumbSubscriptRegionobSuperscriptRegionsCharFollowingPnAscNumFollowingTbFollowingCharNumeric:bFollowingCharSpaceT sCharPrev nAscNumPrevhbPrevCharNumerickbPrevCharSpace6 s2ndPrevCharnAscNum2ndPrev<b2ndPrevCharNumericT#b2ndPrevCharSpacexhlPosE=nRetL nAscDecimalnNumLen bNumBeforeAsc!u InternationalwdDecimalSeparator@Move>yMoveEnd*FindnClearFormatting)ChrWForward MatchCaseMatchWholeWordXMatchAllWordFormsMatchWildcardsWrapWy wdFindStop'fExecuteYFound+ InsertSymbolcharacternumberunicodeWChrK~ vbTextCompare Q InsertBefore.DeletexInStrRevĈ InsertAfterq5App_NewDocumentJDoc EnableButtonCApp_DocumentOpenApp_DocumentBeforeCloseSCancelnOpen5cbcFormatButtonCommandBarControlP FindControl mmsoControlButtonnID]Tag&Enabled۪Class_InitializenCustomizationContext΀NormalTemplateqClass NewDocument DocumentOpenHDocumentBeforeClose/ InitializeNItemz _B_var_ChrW _B_var_Chr\; _B_var_LeftQ _B_var_MidpApp_DocumentChangeBDocumentChange4 _B_var_forjLWmWindowsd _B_var_IfPWindow6App_WindowActivate1Wn_App_WindowDeactivateWindowActivatedtWindowDeactivate mnDocCount% mnWinCount|nCurrentWindowsnCurrentDocumentswnDocCountCurrent$nWinCountCurrent\xomnDocCountPrev6mnWinCountPrevJ  nDocCount\H nWinCountٿ nWinCountt1!ActiveDocument\_B_var_nDocCountQApp_DocumentBeforeSavePSaveAsUIMacroContainer>DocumentBeforeSaveParentSave mnIconBar  mnIconControlЛcZ cbcButtonCommandBarButton9 _B_var_SetIndexcouldube\YoumayŲhave RobtainCopyƿof^this̹Addr Chemistry  FormatteractivetemplateQ _B_var_activetemplateaControlsKCaptionx AutoClose_B_var_cbcButtonu nBarIndex _B_var_Deletea _B_var_Add0 cbcStorageG TemporaryBefore TemplateshTemplate_B_var_TemplateqWPicture*HandleCopyFacezMask-SaveddbSkipOnAction acbcbutton%_B_var_acbcbutton(AutoExitClass_TerminateP TerminateyL as  *\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{00020905-0000-0000-C000-000000000046}#8.2#0#C:\Program Files\Microsoft Office\Office10\MSWORD.OLB#Microsoft Word 10.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.2#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 exponential notationd?<>ThisDocument2V3fb4b167ThisDocument>ChemistryFormat2W3fb4b167ChemistryFormat}0fButtonEnabler2X3fb4b167ButtonEnabler;0P0U`8;iXMM؄ DMQ@'0 0hAnd As.Debug=dimCEachDElseEElseIfHendifOExitQfRFalseTForXfriend_IfbInkIsNotNothingOrPublicResumeSetSubThenToTruetypeofWith(Wordk VBAWin16~Win32MacVBA6#Project1  stdole`TemplateProjectE ThisDocument< _Evaluate OfficeuDocumentjModule1b ChemistryFormatUuAXZq(Class1+EventClassModule(AutoExec CommandBars VisibleAppt Application*(ChemistryFormatter& nViewType lCharCountbShape[shpShape shpOnCanvasHNevChr%*nResult lBlockRanges nRangeCount#lLastEnd' lCurrentStart*[ lCurrentEndrRngxdRange bInTable3vcCellhCellnSTART"nnEND9 (sAPP_NAME (sLAST_UPDATED.+ ErrorHandlerO DocumentsCount0vScreenUpdating!  SelectionZ ActiveWindow+ViewI wdPrintView( wdWebView) ShapeRange msoCanvasr CanvasItemsכ TextFrameHasTextP(ChemFormatRange& TextRangewdSelectionBlock@Start CharactersrgSetRange wdSelectionIP Paragraphsf Information wdWithInTableTRowsUwdEndOfRangeColumnNumberxOwdStartOfRangeColumnNumber7wdMaximumNumberOfColumns*CellsmsToolbarվ mnControldsToolbarnControlCustomDocumentPropertiesޖ Parameterh_B_var_sToolbar_B_var_nControlt bUseDefaults3cbc^} bCreateButtonbCreateButtonIsx_B_var_xVal_B_var_Parametercb\ CommandBarbFound bFoundBarWnBarNameqsBarNameu nCntlIndexr nControlIndexZB windowsupdateM windowupdatecbcEmbededButton"K activedocumen%msoPropertyTypeString4 LinkToContentLmsoPropertyTypeNumberValueK_B_var_sBarName"=The' _B_var_The8 ButtonHandlerBarw myCustomBar _B_var_On6 ClassHandlerRaiseNe`^xt_ _B_var_Resume4_B_var_sLAST_UPDATED ClassErrorHandler {SourceG ErrorHandler3 DescriptionTextbEnableߕ mbEnabledX_B_var_cbcFormatButtonimlIDQgmsTag8msNameWorkbook_AddinInstalllIDsTag2sNamed bFoundParentªcbcs^xCommandBarControls cbpParent CommandBarPopup AddButtonErrorW ThisWorkbook| FindControls<msoControlPopupl)msoBarTypePopup-~Workbook_AddinUninstallRemoveButtonError5 Button_Add ButtonAdd7 ButtonRemoveS_B_var_mnDocCountPrev Collaboration_B_var_CollaborationkptypeBuiltIna Replacemente\Replacef wdReplaceOnen wdReplaceAllu# MTSetEqnPrefsqselectedYsappname^ ChemFormatWDXPkI`_B_var_I  ButtonEnablerA haracters*:nLines5_B_var_Characters[wdFirstCharacterLineNumber[ Containera _B_var_ContainerSections StoryRanges wdMainTextStoryU StoryType]p WholeStoryFields7 vbOKCancelx?vbCancel' StatusBarʜDisplayStatusBar_B_var_DisplayStatusBar·bOriginalDisplayStatusBar}nNumberOfCellssNumberOfCells6 _B_var_FormatbStatusBarWasntDisplayedp6bStatusBarWasDisplayed  ScreenRefreshA commO NameLocal_B_var_commandbar|vnCont Wrol _B_var_nCont _B_var_sName'Clear _B_var_sTagS _B_var_typeofے _B_var_ElseIfqm mbReplaceText AutoCorrect% ReplaceText!/UCase5  _B_var_UCaseas2Char sToReplacesFinda_B_var_sToReplace# _B_var_Stringӊ sFullName~ad~\AddInexFullNameОAddIns Installed sCurrentName sCurrentPathk sThisNameU sThisPathS sAddinName sAddinPath=Path2Title~yl sAddinNamsAddinNa>sAddinN6#sAddinQ _B_var_AddInR<nTemplateIndex2_B_var_nTemplateIndexy nThisIndex˅wdSelectionShapeVersionAn\attempt8`beingmade+SecondssVersionoBuildE _B_var_Select'EhttpgsDecimalPositioncsgl _B_var_csgl9csnl CuriouslygqwhenoDevennother _B_var_Case` 6@ superscripts cN@ical fXulas; conver6* to , --->a pretty arrow, 1E5exp@onentiEnotation@pub- &s perscipt hmi al+fo!m1la#;bcnv * t " ,ŀ-5-> *ap#e3t*yarw1E5 exHon0Zni s2d.l8 f\*\G{00020430-C0046}#2.0#0#C:\WINDOWS\SYSTEM\StdOle2.Tlb#OLE Auto@eC"Offi*cD"O@f_eh A"2DF8D04C-5BFA-101@B-BDE5@"A*A@!42H"Program Files\CommonMicrosoft Shared\ 10\MSO.DLL#G 10.0 Object Library%">SThisDocum@G Th@5sD@Yc@mv 2 HB1w`B,Q!>"B+B istryCG C%erF(r@a2 f}! ButtonEnablerGA%tA^Eba@yUrN&2\//;'(brU~~~~~u a   kSub- & superscripts chemical formulas; converts * to , ---> to a pretty arrow, 1ELast Updated:  DThe latest version can be found at 6spectrum.troyst.edu/~cking/VBE6.DLL i  S 8  X 0CustomDocumentPropertiesSave rThis occurred while removing the button from the toolbar.l FI Fb F Fu F Fso9P F StartEnd 2Finding lines in block:   lines foundR F