ࡱ> +.*^7 bjbjUU " 7|7|l  oooooo$ IIIIIII m0b9bITo 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 2000/2001 or later; it will not work with Word 97/98. Detailed instructions are given at the HYPERLINK "http://spectrum.troyst.edu/~cking/ChemFormat/index.html"Chemistry Formatter web site. Chris King March 1, 2003 KLMij0JjU jU5 lmx 1h/ =!"#$%DyK yK phttp://spectrum.troyst.edu/~cking/ChemFormat/index.html i8@8 NormalCJ_HaJmH sH tH <A@< Default Paragraph FontNN Answers $h5$7$8$9DH$^ha$ B*aJphN>N Title$@&a$5CJ KHOJQJ\^JaJ F"F Test Item! h8hx^h`D"D Test Item indent h^222 anchors$a$ B*ph&B& narrowdFOQF MTEquationSection<B*CJaJph.U@a. Hyperlink >*B*ph  zLiXH  or$-3HޮArb$uRZԳ/=ōrb$%~J(v H֓w\r"$ WIe]Hd2rb$I<<-)&tTrb$ʵ UiviTr@ 0(  B S  ?~CIL:Faculty&Staff, ChemistryFaculty&Staff, ChemistryFaculty&Staff, ChemistryFaculty&Staff, ChemistryFaculty&Staff, ChemistryFaculty&Staff, ChemistryFaculty&Staff, ChemistryFaculty&Staff, ChemistryChristopher King stacy parkerOC:\WINDOWS\Application Data\Microsoft\Word\STARTUP\Chem Formatter Word 2000.doti0V" " V" " V" "   ChemFormat ChemFormat2Y2Y2Y2Y2Y0 ( Chemistry FormatterChemistry Formatter applies sub- and superscripts converts * to " ; makes arrows elegant converts 1E5 to exponential notationChemFormatCKTSUstorage"ChemistryFormat.ChemistryFormatter( p(<<<<<r% )ChemFormatWD2000.ChemistryFormat.AutoExec)ChemFormatWD2000.ChemistryFormat.AutoExit3ChemFormatWD2000.ChemistryFormat.ChemistryFormatter)CHEMFORMATWD2000.CHEMISTRYFORMAT.AUTOEXEC)CHEMFORMATWD2000.CHEMISTRYFORMAT.AUTOEXIT3CHEMFORMATWD2000.CHEMISTRYFORMAT.CHEMISTRYFORMATTER@C@@UnknownG:Times New Roman5Symbol3& :Arial"hZ sd8A:L!x20d]p'3QHChemistry Formatter Add-inChristopher KingChristopher KingOh+'0,     $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^-5Chem Formatter Word 2000s tChristopher Kingrd 356Microsoft Word 9.0 @:3@`gooZ@K8A՜.+,D՜.+,\ hp  Troy State Universityro Chemistry Formatter Add-in Title@0qy)5 _PID_HLINKS ToolbarName ControlIndexAh*8http://spectrum.troyst.edu/~cking/ChemFormat/index.htmlont  !#$%&'(),-01345J789:;<=>?@ABCDEFGHI2KLMNOPQRSTUVWXYZ[\]_`abcdefghijklmnopqrstuvwxyz{|}~Root Entry F/Data 1TablebWordDocumentSummaryInformation(DocumentSummaryInformation8"Macros`mVBA ` KThisDocument__SRP_6__SRP_7 BChemistryFormat 6  !"#$%&'()*+,-./01345789:;<=>?@ABCEFGHIJLMOPQRSTUVWYDr>>#< WK$ F WK$x WK$ WK$ME(SLSS6"N0{00020906-0000-0000-C000-000000000046}(%H@h % %Xp@@0´? $*\Rffff*1?3fb4c31b4xAttribute VB_Name = "ThisDocument" Bas0{00020P906-0C$0046} |GlobalSpacFalse dCreatablPredeclaIdTru BExposeTemplateDerivBustomizD2rU H!)!Q!4y!!`rU @n#e7*\R1*#17b*\R1*#c1*\R1*#c0*\R0*#10*\R1*#e*\R0*#e*\R0*#1*\R0*#14*\R3*#30*\R3*#4d*\R3*#51*\R1*#c8*\R1*#c7*\R1*#133*\R3*#50*\R3*#8c*\R0*#13*\R0*#19*\R3*#4f*\R1*#d1*\R1*#c5*\R3*#2f*\R1*#c6*\R3*#51*\R1*#c1*\R1*#c0*\R1*#c5*\R1*#ec*\R1*#129*\R1*#d0*\R1*#158*\R1*#71*\R1*#153*\R1*#156*\R1*#78*\R0*#2*\R1*#d4*\R1*#dd*\R1*#de*\R1*#b6*\R1*#e9*\R1*#d8*\R1*#21*\R1*#1e*\R1*#e3*\R0*#19*\R0*#f*\R1*#d6*\R1*#b5*\R0*#9E @ D@ F 0 , 20 h  D B  8  HP  * " BX ` h " * L&8H "P 8X   , " <08@HPX`hpx  X X DH1 d,          ( 8 .@X0` 2 :8 2x   <'+>߀ xME " 0(Lt(L~(L0L(L> LLLPL*LLLLLLLL*LLLLL*LLLLLLLLLLLL*L<<<<<<"X @\hH March 1, 2003a%Chemistry Formatter0%  ``x tk d`0xk% b`` o-`hx `jt}E mpof t%`nlment`pj( rd,%`v``x\@zZ |TX %`R `P f `pk++ mx%`t@r P`k@z`t`r l%`j @h`X @xV `4`@@.`(`$`  %` %@B@B  `` k)F %`Ht`Jp`Ll@j`Nd`P``R\@T0Z@VX`XV `ZT \R  @^P``N `bL dJ@ @fH`hF `jD lHB P@n@`p> `rH< `t8OT@v6OT@x4`z`2  @€"@Z(`@^PH P`(V0  b(Z@H x @t x`@X(p0  ` p (H@H L @ H @( D @x 4 @ $ @  @  @  @  @  @  @8  @P  @h  @  @  @  @ @ @ @p @ @X  "TR@@ @ @ 4@O  4@~ @x @ t @8p @Pl @hh @d @` @\ @X @T @P @L @(H @@D @X@ @< @,  C%(`P%H@ @ @ @ <^\Zf@x `TRH( "@l @Hh @X @H @08 @( @$  x`|%`@ @ @ `@p ^\@0 @H @` @x @ @ @ @ @ @ @  @8 @P @h @ @ @ @ @ @ @ @( @@ @X @ @ @ @p  (h8xH(X U(@ APP@X Micr@ U@ U`% -@0 OWS\H7n Data@O TUPp07ord\ST@ 0;`\"@ Q@8_ Q@` @ @0 @  @x @ @ @ @ @p h@n (l@l/ XlhP`%h8os(,.0:>@X @H @D @@O @8< @P8 @h4 @0 @, @( @$ @  @ @ @( @@ @X  @p @ @ x^@ @ @ @ @0 @H @ `((@xx(p @!  Fx@ , @( (|>X@ @ @ @  @8  `% B@P @h @ @ @ @ @p @` @P @(@ @@0 @X @p @ @ @ @ @ @ @ @0 @H @` p @x ` @P @@ @> 8 `% ! aX@X!4 @0!2 H!!@!0 p!0!@, !0!@!* !!@!( !!!!S@"& "!g@@"$ 0""gX""r@h"" "@"@  "h"h"`PP  ´? $*\Rffff*193fb4c2bd*\R1*#d4$*\Rffff*183fb4c2bd*\R3*#92*\R1*#132*\R3*#4e*\R1*#155*\R1* D D P D` & DQ   F( p ; n !      PO H 8X 8  PW 24   ( 0 @P  4X,76    $ D  h Dx < lp:x$   &       <8 x 6  *: J48     0,( 8 @@ *F  B .@qH&1 : B8 H Xhp xC  HCp" H F D@ H . F HH H   $DQ X h 4!p *    0@ !H !h   HC 4 " L H *`  ! $8! (`! *! $! *! B" 0X"2" "0":# @#:X#6#<#*$6@$Bx$:$%2% @%,P%8% <% % <&   & N0& 4& && & @& 2' JH'4'' '' *' (#(/ (8( @( P( X(`(  h( .p( H( ( F( F@) ") ) ) ) $)  ) ) * *  * 0* 8* H* X* :h* :* * ++ (+8+:,P+ +@+ p, , ,,,,,,,, , , 0- 0-$#H- p- -*.- -- - 6- *.. zH.  . . . ,. / : / `/9p/ / B/ B/ < 0 "`02'0 :0 01jX01111 1 :1 @2 @2H2"X2 h2 x2 2 "2 !2 B2 :3 >@3 03@'3883 ,(4 X4x4.4 >4 >4 : 5 *`5B5 555 5 666 (6 86 @6HCH6 8 8"  8 L(8 Jx8 J8 J9 "h9 ,929@9*8: 8h::4: ,:.;F@;H; 8;.<88<6p< :<<<< J=P=X=`= h=*=4=L=68> !p>> L>8>  ? H? 4X? 2??  ? >? 90@ 4H@@ 4@ "@ @ >@ 48A(pA A  A D A  A  A  A  B  B B [B B!(B 8B XB :hB LB &*B  C(C D0C xCCC >C LC 4(D "`DD D D D D D D D D DD D 6E  8E HE [PE XE ^`E ZE 2 F&*XFF FF F FF 2F F G [G G&* GHGXGhG GG G GGG PG H JH L`H NH I3I0I8I@I XI 6WhI  II III :I J(J0J8J PJ .`J BJ  JJ JJJ NJ , K PK hK K K K K K K K L L  L 8L XL xL LL4L&L &M (M 0M @M;`M xM 8M 8M M :N <HN N N"7N0 NL.O`OhO;pOOOOOO O OO 8O @P p@P L.P Q Q Q Q Q (Q N8Q "Q 8QQ4R` R R lRL1R HSPSXS &`S S 6S &S T T T T  T (T HT0XT%xTT 4TT TTU U U 0U0@U%`UpU 2UU UUU U V0 V%@VPV 6pVV VVVV V 2V <W  XW `W;WW 2W>WW .X 0X PX 8`X X <X 6X20YhY>pY 2YY>Y >Z B@Z 6ZZ>ZZ[ 2[ .@[ 4p[ 4[ 4[ \ ,8\h\ 4\\ :\ ]lC^!;^!^^^^^^^ ^ ^^ ^ R^ :P_ _ D___ <_ 8` ,X` ` "9` j` 2 8a 4pa .a &a4b8b4Pb pbb 6bbb @c@cXc`c hc 6xc c"9cccd  d 20d hd"9xddddddd 0de e(e 0e $8e`e;e e e <e0If-0f-Pfpf xf f f fff ff: 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't* appear in the list of available toolbars.& CustomizationContext = Templates(1)M, CommandBars("ChemFormat").Enabled = False@ Templates(1).Save}E> The position of the button is stored in "DocumentProperties".W; These properties were initially added to the template with 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.]@`]@ Records AutoCorrect statusE; (If on, fancy arrow is replaced; if off, --> is replaced.)]@] ]$Chemistry Formatter(]$ March 1, 2003D# Add the Chemistry Formatter buttonA@bE Start the module that controls whether or not the button is enabled. ( Z/&o1 Unload the "handle button enabled" class module. Z/&.Z& Remove the Chemistry Formatter buttonA@fo6 Adds the "Chemistry Formatter" button to the toolbar.]X]p]]]]]]](]@]`]xhQ Check the version of Word. If incorrect, inform the user, and unload the addin.Q 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.D (!$ D (!  (%'h (!$ OT11'j OTXP'j OT2000'jOT97'jS (!$'jn     DThis version of the Chemistry Formatter requires Word 2000 or later. 'You are currently using Microsoft Word  j.   EVersions of the Chemistry Formatter for Word 97, Word 2000, Word XP,  )and Mac versions of Word are available at  %spectrum.troyst.edu/~cking/ChemFormat $Wrong Version of Chemistry FormatterA@, Don't run the rest of this install routine.4 Following doesn't work on earlier versions of Word.+AddIns(Templates(1).Name).Installed = False|Hk@> 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. HlJChemFormatCKTSUL (!D%F.l l? Check to make sure the add-in isn't already loaded (perhaps as a different version)$!'n$!$!'p r  r! r!'v vChem  vFormat  vWord  r! p1 An installed "Chem Formatter" addin that differs1 from this addin is already installed. Exit with a message.$ #+/</An attempt is being made to load a second copy /of the Chemistry Formatter. The first copy is:   v,  stored in   r!  The add-in trying to load is:   n,  stored in  $!  :This add-in will not be loaded, so as to prevent problems. "Chemistry Formatter Already LoadedA@, Don't run the rest of this install routine. p$(|kkk r lB@k. Retrieve the previous location of the button.$ ToolbarName7!'  ControlIndex7!'"q Make local copies. 'x "'z T'R> Validate the position in case the parent control was deleted. x> The commandbars collection doesn't contain popup commandbars.5 No way to find out if bar exists, other than to try.f (commandbars("Tools").Parent is sometimes "Microsoft Word", and sometimes the "Tools" popup control.) x (%D.| !X |!N  Toolbar exists and is enabled.'k d B@ k k  Use defaults6 Can get here if user deleted button or its container. / Place the button after the "Justify" button on the "Formatting" toolbar. Formatting'x# Find the "Merge & Center" control. x (%D.| Hl{J |%F.l- Find the "Justify" control. l 'zdX l! 'zk8 k0 * Ensure that the button position is valid. z |!!> |!!> 'zk : In Word 2000, the template's toolbar isn't exposed unless a document is open. @!> (!<B@'k0 < Create the chemistry formatter button. It is stored in the' "ChemFormat" toolbar of this workbook. | z ChemFormat (%D%B@ChemFormatCKTSU z |%(L3 Make sure the command bar containing the chemistry; formatter icon is visible so that this add-in can be used. |!l  |! |(kk $<B@Bkh|`X #)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@ Keep tryingopB 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.A 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 distinguishingA name when it is created, such as "Custom Popup 110993829". ThisA name isn't accessible to the user, so it uniquely identifies the popup. Find the button. T'R HlJChemFormatCKTSUL (!D%F.l l l5!'!" Commandbar containing the button. # Record its position and delete it.5'C@qk    ") Button was moved. Save its new location   ToolbarName7(  ControlIndex7(C@qhk`|XP #)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 selectionA may be a normal or block selection, cells in a table, or text in# an autoshape, comment, or textbox. 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: Christopher King" Chemistry Department# Troy State University cking@troyst.edu# phone: (334)670-3576< home page: http://spectrum.troyst.edu/~cking/]`$" View: Print layout, normal, web.]x$# Number of characters in selection. Shapes.]$! Indicates selection was a shape.]$+ For iterating through shapes in selection. Block selection.]', True if status bar is originally displayed.]$( For iterating through lines of a block.]$- For enumerating the characters in selection.]$ Holds msgbox return value.](' Ranges in block selection]h$4 Number of ranges (blocks of contiguous characters).]-& 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.] 8 Indices for lBlockRanges array. (!<!>G|j ((H Determine if AutoCorrect is turned on. This is used in ChemFormatRange. to determine which type of arrows to replace. !'X : 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. !!l'    5!> $ Format text within selected shapes. 5 !!  !!A@ k 'kk  ' 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'  +' (!'  (( (( (B@ ((k 5 !' !'3 If the previous end is not the same as the current3 start, then the boundary of a contiguous range has been found.     +  '   +Finding lines in block:  lines found'  &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.  \$'    (( ((|XdPyHk@k8k0 '    + * Format each line of the block separately.  Line left to format: '5.   $  $C@  A@ q0  0 Collapse the selection to the end of the block.  $  $C@ '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.5l "7$!B@Hkp ; 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. (7&0 Within a table.5*!> 0 More than one row selected.4 If entire rows have been selected, they will format) faster if treated as a normal selection. ,7& .7&  07& B. Not all of the cells in the row are selected.'kPkHk@ 3 Format cells in a table. This is slow to process. 9 Takes about a second per cell on an old 200 MHz Pentium.  52 !A@    Normal selectiondh 5A@ 5!>'; If an entire paragraph is selected, collapse the selection3 to an insertion point at the end of the paragraph.7 Otherwise, the original selection remains, so that the) user can see which lines were formatted.5$!>-* All or part of one paragraph is selected.5!4 3" If the end-of-paragraph character3& is selected, then the whole paragraph3 is selected (probably). :8C@6 >  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.5@(B01 So the user won't be typing sub or superscripts.5@(Dk k k k k q Selection ((|  #)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@ ((oPF Formats text, e.g., H3O+, as a chemical formula, in which numbers andC charges are subscripted and superscripted. Asterisks are replacedC with "" (the centered dot). The arrow created by typing "-->" isD replaced with a prettier arrow. Numbers in the form of 1.43E-7 are replaced with 1.43 x 10-7.]' Number of characters in range]'# Character position of end of range]'1 Holds selected text for sub/supscript processing]' Character position counter]'* Start & End of range, so it can be reset.]0]H'& Stores two characters to be replaced.]`' Character at current position]x' Ascii number of that character]'7 Indicates a character is in a region to be subscripted]'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]H]`]x]'7 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".]@'' True if a number field preceeds an "E" F!!>'H H G|jE Some countries use a comma instead of a period as the decimal point.  (%$|'v HB If just 1 character is selected, there are only two things to do.- Replace asterisk character with centered dot, (Find doesn't work on a 1-character range.) F!d* F(d 8 Move insertion point after inserted character, and end. > %~'|+ Nothing else to do, if just one character.kx?. Replace the arrow made by typing --> with the prettier Symbol font arrow. F!'J8 Find doesn't work on a 1-character range, so extend the- selection by one character before searching. > F%' F!C@^u616649d- The unicode number of the arrow in Wingdings99999 9C@q= F!!  An arrow was found. F! J 4 The arrow is the selected character, so replace it, E and exit. (The alternative is that the 2nd character is the arrow.)Symbol@ FB@k<k<= The rest of this procedure requires more than one character, so quit.|p<kh<7 If get here, then more than one character is selected.E **************************** Replace Arrows ************************. Replace the arrow made by typing --> with the prettier symbol font arrow.' F!'N F!'P F!C@99999 9 X / AutoReplace is active; replace Wingding arrow.^u616649d_:C@5W find.replacement can't be used because it causes the whole document to be repaginated.S Repagination took 16 seconds on a 90,000 character document on a 200 MHz computer., The InsertSymbol method doesn't repaginate.Symbol@ FB@ N P FB@ d`9xX9kP9H9d@9 , AutoReplace isn't active, so replace "-->".-->9d_8C@5Symbol@ FB@ P 'P H 'H N P FB@ dx8xp8kh8`8kX8qP8J ***************************** Replace * with ************************** F!d'LD Tables have an end-of-cell marker that is counted as two charactersE 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 a space. $$'R'_6  L R'  L  $  L  $'L  'dH6x@6k86063 Replace all occurrances of asterisk character with centered dot.'_5  L* '    F%B@ >  F%B@  'dH5x@5k8505G **************************** Subscript Numbers ***********************& Here are some ascii codes used below. 9 "tab" 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  H L $$|'T T/ T:  T v Character is a digit or period. X T v Character is a digit.  F%!@(Dd2 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. 5 Also, don't subscript if it is followed by a letter,  as in www.chris.com  H L  $$|'T T  T  T. T  TA TZ Ta Tz T) T]'Xd0  F%!@(Dkp0dh0'XkX0kP0kH0k@0d80 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 ) ] TA TZ Ta Tz T) T]'Xd.'Xk.k. H ************************ Superscript Charges ************************** Superscript + & - charges.2 To get here, there must be at least 2 characters.  H L $$|'T T  T  T  T R) space, carriage return, tab, or linefeed'Z f UPPERCASE letters lowercase ) ] TA TZ Ta Tz T) T]e'Zk, Z  43 is +; 45 is -; 32 is space. T+ T- / First characterize the surrounding characters.'`* Initialize all to False.'b'h'j'p'r  Following character  H L  $'\ \$|'^ ^0 ^: - Following character is a number from 1 to 9.'` ^ e'bk*k*  Previous character  L  $'d d$|'f f/ f: , Previous character is a number from 0 to 9.'h f e'jk* Second previous character  L  $'l l$|'n n/ n: 0 2nd previous character is a number from 0 to 9.'p n e'rk0)k()k ) , Now decide which characters to superscript. 6 Don't do anything if preceeding character is a blank. j Superscript the +/- sign  F%!@(B `, Superscript a digit following the +/- sign.  F%!@(Bd(( Don't superscript a number following ). ) n)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. h f0E Don't superscipt a zero. p  F%!@(B+ Superscript if previous number is a 1 or 2 f1 f2e  F%!@(B8 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 O f3 nOe  F%!@(Bk%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. h b. Don't do anything if at start or end of line.  H  4Superscript if not followed by an end of word token. ( , . : ; ? ! tab carriage return ^( ^, ^. ^: ^; ^? ^! ^  ^   F%!@(B'ZkX!kP!kH!k@!k8!k0!k(!k !k! L ***************************** Exponential Notation ************************3 Replace any entries like 1.45E-7 with 1.45 x 10-7. H> At least 3 characters are required to hold, for example, 4E7. H't_ 5 Look for capital E, beginning from end of selection. LE t $'t % Ignore if "E" is 1st or last letter. t t H  L t $$|'^ d Digits + - ^/ ^:  ^+ ^-. Character after "E" is a digit, +, or - sign.( Therefore, a numeric field follows "E". Find the length of that field.'x% Must contain at least one character.  t H L $$|'V Digits V/ V: / Still in numberic field; check next character.  t 'xd: Not a valid number field, so last digit was end of field.  t 'xyk 0 A numberic field follows the "E". Determine if one preceeds it. L t $$|'f'z f/ f: 'z f ve, Check that digit before decimal is numeric. t L t $$|'f f/ f: 'zd0'zk d) The word begins with "+E", so ignore it.'zkk z Exponent detected; format it.  t t x   F%!@(B  Insert " X 10"6 For the "X", use the symbol font multiplication sign.Symbol@ t F%B@ 10 t F%B@  t F%B@kkdxxpkh`kXoPHAttribute 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 bFoundPfas rqb9ped`]:On Err *GoT>o2')' i ckvvWg@F ~DinGaF,0iQ}, (RӖ)`in''xriouslyᅛt mlonRwro@l,Vp7;codwbruns, e>vLb8MuresP  won'Q;mpileW 0 pk(X8.d#)p < 9` '= InStr(2, WI"rnr>al(wd+Se a)JSelq\Ca "-rIs >= 11<@#s0Р11QI0Ob3@XPOn9?5`X0_R8_U97>E0?T%Ms@gBox "< X&!%Mr requi!$/e0]qr." & vbCr`_+ "You 9 cux$nt0usјMisoft !& "5X"s r#897,!XP, x A<`? ! /%vbTab"sp,rum.troyst.edu/~ck/ ~]@vbOKOnB"~WBAu,@' D>0AR?t DF rou?=p'ƀBrk堓 li@"CVIns(]).`M= g0ExitS~If2$B' I!)already@es@, dp-)it0#(,cl s up41ctPVa du0,,, hapScomp lp ' crashed@5fi S\1u;a %d haqdiff͠tag3z=zUWps.Fr #(vCn, ID:=@Tag'CKTSU"T} PUz`Vro make sf&Pfi eq( a0&4&]7= %r qdex = AddIns(Templates(1).Name).DIn For Each ad In8B If2dstalled Then<Bsinad !CInS@tr(1, -, "Chem") > 0 An$5 $mat&1 LWord%Rd<> nThisi'JX in}W Gter"din that dif0fers{"frdomisl ready.. Exit with"a mes sage.MsgBox "An att}t being made to loya seco@[copy " & vbCr_!0 "of0e listryA.[ first is: & ",estorrin% P8ath>a@9add-A|ryUET;B̿;6"!#J"aW!will notH beIeduo asKprevent problems.",`KOKOnly}lG( Al`L Sed"1P' Don't ruAme reLQ[s routin3c}!ez= FalsFeqSubnE9gIfn Ne xt`(ecbcButton.De8let(' Retri`*Bo+ious.cation drb# b:W = :msToolbar`.Cu gmDocum5Propehrti@"AS"@).ValuF#mnControl;J"' MakAHcalsBarc= F"# cizB#!.= Norma&l%"d' idc#+osi*@{cas@he paraY bw@\db5d`f""'mmand-.s`c do,es!Za a`popup# 6' waykfiN!\ if exis, otheraco @Q(co(s 0P 3someti`e "Microsoft rt, @ f .) O n ErrRes% 1/Seab#Appli+.C s(.Numb =XGoT~oq5"eP pc`b.Ena Iߋ 1re bFound= Tr1<{E Clear ? <: H' U*default' CP g !e"ust+ B it)dnt'er#pNop] ' Plac1afP4"JEify"6'T`s" tv4= "xu' F/(Mergep{C99&0V&PX*"dL I(Type:=mso', ID:=123)@ F] 2)%Is@>th.N%O13E E%e+ 1@Dk%' Ensu^r!tpQs` valiP> s=uQ D.ɁI 2000,2%Al0\'mirUex punlq a dnqonC#W%owFsK%ss.@ byed#ACt3c`ϓfir3I?$ 2F4CJworkbookS oVdbV))C.:=cb, |BeP p/" ().TagCKTSU&eoRm2ain0o($ivisi]jr+tcP@P'+0 auniquely idifiCa$`@` On Go :LA W' FiTizNC[= NormalTem6pmSgO= AppliU.Pls. L n(Type:=msoc, ID:=1, Tag:"=emFtC`KTSU" g`If `?F_Is2*enWithd&b= .PI.Na9'%h@R@KntW`="Qc$@@axcordLosigdeletem  Index.D?"%AIf6@<> mOr  `\"R' wSm@d QSkits n8ew %B(Macr4!erE ".EDocntPropert S ("d*").Vpaluees("$C%E'Ex`t (b:BMsgBox "An~~g`7~ %A~Po63Ƅ~e re* frPL>~~~XtF :~~L~~~he aH~~T" ~u~~' 7c"Ps, e%w Fo ut doans s to be formatted' TablelbInWBoolean X' Is theMlec intC?cCell@ForD iatithrough ces'se-J  Ct nSTART = 1, nEND2 Fndicesh lBlocks array@On Err8GoToHandler OIf ApplicGon.Docums.Count40 The"xit SubScreenUpdh= False' Devmine i5 utoCoct iurned:  us@UChemJj+B5B+'pdwhich type B:wo re0placu@8mbRTex4A .H+With ~S`@1L\ @shape,b;AbLj,B.ya Œ, @fa "nyl" n B Can't haveSAD unlesŒPrij@LayoutWeb DviewS@nV@TK= AveWindow..*3 wd Or @̀.G+ē> Ó I ' = tA4w@0?a`A+s#@ Ea?shp In H k ` .?Frame.HasA,@CLO@;pAGRIfNAb"#kTru@e+eNotf ' BH (made usalt-mo`k)hnabAG 7 timslowerampro jh`a UTFBHwd&hc3-Ae Ce@brok`Qncontigu`íA o Sɡe n,Air starBh"' e posar)blLasb=P (an) $nJ%1bStatusBarWasDis@yc yFKG2 4 W?, ~dRefresh g?g`& 5cCvChrCCes0 rc1.Ȋ= n' pdpreviq-&pn=e0J aA7߀+O+,nB ."3/,s/SU/+ 0#e36T?ds5)"FqRlu"J: " &  &C")> 40oTa@nResulQ&MsgBox("p hist+ can"PY moIt!Z5 aU'A vbC:r _ "YouӇycR@t. Only(first  wi0", vbOK0, sAPP_NAMEi anpo uKHPt_Pedn.G_MeqEƳYEⲯ Nc  ==IKqMk_8V8B?ϗQ'eaМA%GLaPÁsep t,el ! N ;601 SteXp -Bz>L= pleftQ#D>N Set P~1 R!.b :=NJ,o1p]?@A ' Collapse2 1C' M 3|oL$ @i@@>s2been ,A>ChemDC#Next*)oMlCharcu=ac`dw-? $ )$rFKcollapsţno2inޡǠ poin7tb^e8$WU"O`[r0wiseig in rema `o a  uc see (whiPlp^s we2ES00heEO=O' A18r]\Q\a LPL8vbCrU"t=-of-}c_'K3fxo (@=bfy)87v0$%D`:=|wdO&T.MoveRighLt , /- 1' $ቚdlB m2nA"jthprettip?0PAy1.43E-7 are ' replaced with 1.43 x 10-7. Dim lCharacterCount As Long ' Number of cZs in rangIniti`alEndN'B k pos.o:nSe2ZLsTexStri ' Holds seled t2for sub/supscript process"wN %ScerRn`gStar-'2 & p, so it can beset)WsFiStores two toCÃF|nAscb@ I@a*urremC&ii nƏthCbSubCkRegiBoo leHD' Indicat@9a8 iaQC<edper/,sTFopllow0Dl* 1F1 fF cDWWGz'@cWF 6ericatg,' True, if4,#8iccbJ lSp@ @?] a s%j'Prev! N' sreceedA-(A As -f2nd~eco@vp@iousUbee the { 7o' 1E5 -->`Q^5lPosEg!mL' `fEc uAUDecpimal+QUe dM_Len7u waB\fiel!ms "E"b BC2/cb b ?;O% D = >r"ԡ%aOs. `If <4Th Ex ŘSub `Kom`G Ari@use !omma2stHeada ipod a0a&epoinfP)= c(ApplV DInnatal(wdSep3f)) = Uf justpv!E{,1r 0onlybl th= o do;R isk52cjer(dotW(Rtdoesn't work pfa 1-' . @ "= "*" Oo`"' Move!erA af0 T ,p*d `#NS$%, 1 #Š2o el"0rdo^Bon%^3aIfD@' uKarrow @made bypQXE'etti`3Symxbolepl 3`//a'0-Q zpYsearc' ?Q`  >Wq a E 0.CprForma ng%&^u610664"At;unicoY2r@m@Wqpsw8ard0#axMa tchCa = Fa!Whol8eWoAlvlQ s OAW0ildc0 .Wrapwd!StopYExecut3r%9!.F@Qd9Pgn *wPf1<= )>@0a@S &Go(<`, "ae]. (  al@WaBQ[`NJ 1J'InsF47Fo nt:="",%:=174, T&:=A@ctqgPFsdu\requi}qm@^wZ7F'1ѰioHdget hP^c" Jƣ/B://!-a$=- - 2hS @lCOCft~-;< ;c w;{ ' *  q! * w!sdja' Tables have an end-of-celparkythatc!+`awois$ byInStr fun, but @oneGT irAi.s(N)D eval4ua ![luhere! !boG # a sp`bsCChr(13) & !7N1'caB(Nl?'C@=`N > 0M%/LefDt(, NW1" "`Midq'+ 2f N + NhM#Ea:occur.c>of2terisk2aJcPepAXt =["*>vbC@_are_v)<!.#]Abf "tOc@BDPtod,: [EZ:i; Subsc@ript Nfsw:H!-.m8sciisd {|l%' 9A "tab' 11linefeedf3briaPkreturn32 40(C)U+4,5U-6.7/8-57 digits 0-965-90 uppercletQ97-0122  ' 25A b"SJ8= 1 To b nAsnc#@A(:$)9-(> 47 A]< 58)P Or =D@ecimal]C'IA or Yio:Gb R|eg!5p P>$#!#@F77.3_t'H3abs4rConly iY@'Ѯ not fol!"3yW_!mpgph# ' s,5,ap 4xlas`mQs6Also,`W if k /_bsQwwws[.k 0N <-Ͻ&cP!= .h?.F%E/> 13026.9 g@5= 65n= 6j9}8>228419937= . j"l?49 f End Ift XL Else' The next character will be in a subscript @region =` 65 A <= 90) Or 97122a= 419N3ObSR = Trus l Fau|GNAzN ' * Super#}Fges **T' + & -{o get here,re mustTat|a2Gs F@N@E1 To lA#¨CountrY@s(Mid(sT:, N, 1)) { 32 h13Ml !hen` ' spac@2car riagetuDrn6ab,linefeedECnFV{n ÀLaFaALaaar @fajnaaO#IaKZ0`43 +; 45-; > b7L$ HC~ 5pw' FirVize"s SdingY2bFollow`ZNumeric]AKInit(iala ato "` SAReNPrev0 9 2nd A ?)e!%K3N < 2s+! + 1 =0 FCbJ> 48f*< 58) !+a numbyfrom 1 9 _%S%Let?Q24P'e +;?B' $iousᰏ N >_ 2!-$fBD`Hk0oEbA; =U v?9_Q>3PecopEw`m!2/dsB2O;sH}uV'  /;b`nO2f9?f;o ȋ ' Now decide which=s.sL' Don't do anythtp@c ʂ4blankL!'o3@ +/- sigrng@Select.s(N).Font.ٳ޼ ? ZZ  a digit fVs LO @ p p$@A'(Ѱ5kf ) @Ӯ*o;><`;c ?u0#n!X, so)eck'er/  `f P ԟanյ ' it is preceeded by a number orx3(les0s. If bPrevCharNumeric And nA sc4 <> 48 Then ' Don't supersciptuzero`fc2nd fPrngSelection.act:(N - 1).Font.SCrD= THrue)' ifviousQa 12"Elseh = 49 Or = 50$r[qa 3F 9CnotKO . ({'LaVPDnB word@7ken `Q(},W;U;Q ?W!UtabPcarriage retu~r0,di#{0wBp}41#!6589٤633rJ`130?_vO = Fa~Gb-Reg@N`~/+o  > Next N ' * Exponential =OaT/"' pReplnLBtriesKke 1.45E-7 with x p10-7C0K>=IK' At `leastls ar7quir@Jdhold, 2fib4EtlP8osE%$Do' LookAcapitEB,jginn0fromQsƯInStrRev(sTgEgѱ*Igno h"E"1 lletP9W" ?A^c``>F= a(Midu + 1,0'/Digits+-m(N pQ7JJ 58)wV03w5J' u( af@ a Bd, +,{-p sig_qr:ep)eAfield&s!K' Fi0leng40th nL=Mu@$caQu4=ץ_ N2%+ 2 To $$~No$!$#$ q% `4.DSt @ ";peck nQE/B2  Else  (' Not a valid number field, so last digit was @end of>.nNumLen = N - 1AlPosE-ExZForEmIfNext N ' Aic follows the "E". Determine "i-' o preceeds iBtrnAscpPrevq(Mid(sTJ, tAz, 1))PbBeforeFaIf ( 1> 47 A < 58) Then12TruO~= AD@ecimal'@ CheckSab3dDis`peric҇@H> 2V0&TY2SY@=RS J~'R word begins with "+E"xignNY?rQ`0 U' hExpnn@Jscted;wrm`LW4=m+T` + QcrngSelection.Charars(N).Font.Superscrip~ttge@L' Insert " X 10",' bX4usesymbol@ !multiplica s 8jl).cS :="cþ:=180, unicode:N=u_Af ("A `&}"Qnf"Do2Loop  !Sub __SRP_2/__SRP_3=ButtonEnabler :__SRP_47*#*#8*#l#*#*#*#l*#*#*#C*#*#*#:*#*#;*#*#*#<*#=*#*#*#>*#*#*#?*F 24)lh6p` 4b tx!lh$pCX 4 K9 $  , 3l) C$  &$ X @Dk $ <Q4 $ 8 E (Flpz) kzkz' 0G (Hl 0GQ[lI#l I lJlR/ l I PJl =K[ L)  lI/pr kr DGl* ,Glq(l(4p.$$  kpj kj$  $  $  $   `GQ[XrXAM"q$5XAN"q 5 l$l(l(k.4 k.p.l$k.4,Ok.#*#P*#$ 2 k.@'p':6NQ*#R*F^pV/6pkVkj$  $  l q( Xsl k.4k.hkl#Skh#*#$ 2 Gl=K lh.kh4kh4h Kl Lch hel+.k.4k.4 8G,$  kj%$   DGl~9  xG T U |K)   G5'' G Vl%X G G(pX GXg6pX#prU~| i Y  I !  )  1 I AI a )QyIq IqA Iqa)  q ! "1"Y""""AI"#1## $Y%&1'Y'''' ()(((!)Q))a**)A+) ,)l4 &x$ Qx[t$ $t04$b xth4c=[x$ $x c= @4$b x K 1HL$ L lH  /HLdHL$ L >HF$4D$ D 4`1x)LD64$HL$ L lH t /HL o CtT o  CtT o   CtT o $ CtT.HL$ L lH 1t/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$ -LL .lLK ~T /k~pR -LLHLK  kR0C\:l\F%DL$ L D HQT)LD4L'%'%'%({%%T /lL=pL lpcy pZp (lpZ,kZLT /L (1lL(LT /L (1lpZL*L$ 0L 2lLfF'''$'4DL$ L ,D D3)LD64$pPqkZD%lTo%(%:4%DL$ L D H / ,1 () LD1DkZD%LT /L ,1D ()LDT /lE ~T /k~C T /kP C'''$D(4L$ ,L 03D 5)LD64$ -LL . -DD ,.'':6N$$7*#H*#8*#l#*#*#*#l*#*#*#9*#x*#t*#p:*#l*#h;*#d*#`*#\<*#X=*#T*#P*#L>*#H*#D*#@?*F4 24Hxtplhd`\XTPLHD@)LD64$ l P8 (plTx\`dt&Hxtplhd`\XTPLHD@<LD4$,WCxKh$l$ PQl[h$ hQ$'(%:8%(H%X%hl$ l h Dl$=x)lh$ lxc lx !l (l />1tl (lpr'X% (c lt=krcl$ Ql!ltF8%:X)%AC*5!krD8%:X+%AC*5 Bc -ll . -hh ,.'p':X6Nk pGQ[D@W~" Wl=K[ L) @WO" Gl=K[ L) ! `G Xlqt' xG Tl8  `G (X Kl0/)  <G5.'lti G6 <G xY <G pYc$   - .0 -  ,.'p':6N7*#*#8*#l#<*#8*#4*#,l0*#(*#$*# Z*#*#*#:*#*# ;*#*#*#<*#=*#*#*#>*#*#*#?*F 24<84,0($  ) 6p$  4  p hD@4Xl#<840,($   pXHC0 l x!(,x XK, Xl(qt,lt;8,$ ,  [p6/,5ltcx Kl\0/ ]x K9((,$ <, XGl(pj,6(x 4Kl(qp(((x Kl(pj6,x 4KQ,  ^ _ ^  ,^  H^  `^  @^  P^ ^[>'@'`'''''' '@'`''''' ^6`@ `@c!>,x 4K, 8^k>,^(x 4Kl(lp\*'f:`Nx K6pj(x ,Kl(qd(x 4Kl(q`,x 4KQ,8 8 ^ 8 ,^ 8 H^ 8 `^ 8 @^ 8 P^8 ^   _8 ^[>'@'`'''''' '@'`'''''8 ^6`@ `@>8 8^k>*'f:`Nx K6l`ldx K a8 ^[>'@'`'''''' '@'`'''''8 ^6`@ `@>8 8^k>*'f:`Nx K6l`q`ltqtl`ldx Kc8x K>1l3  b b`1\6pjkjlll\pj kjWkjlM@ c :d'kjlM@ e`1l6  kjpjpjkjll\pj kjL.]4kj,x XK, 8X4 K),4B((4kj,x XK, 8X4 K),46 kjpjSZjltc0P4(kjlM@ e [pZ/6kZ/kZ:kZk6kV kZk6 ;,4kj,x XK, 8X4 <K, pY),4, kjlt7(kjlM@ e [pZ/6 kZ kZ kZ.kZ .kZAkZZkZakZzkZ)kZ]pV;,4kj,x XK, 8X4 <K, pY),4,pVD.kZAkZZkZakZzkZ)kZ]9pVBpV jd0kjltc(Q 4(kjlM@ e [pZ/6 kZ kZ kZ kZ pT.kZAkZZkZakZzkZ)kZ]pTkTE kZ+kZ-C pNpLpFpDp>p< kjlt 0(kjlM@ e`R6%R3# [p>lRGk>pP/kP0kP: pN kP  pL kj 0(kjlM@ e`J6%J3# [p>lJGk>pH/kH/kH:J pF\ kH \ pD kj 0(kjlM@ e`B6%B3# [p>lBGk>p@/k@/k@: p> k@  p< kDA ;,4kj,x XK, 8X4 <K, xY),4,kN >,4kj,x XK, 8X4 <K, xY),4,?  k@)= kFkH0 k> >,4kj,x XK, 8X4 <K, xY),4, kH1kH27 >,4kj,x XK, 8X4 <K, xY),4, kH3k@O >,4kj,x XK, 8X4 <K, xY),4,; kFkL9 kjltkj7 CkP(kP,kP.kP:kP;kP?kP!kP kP 5 ;,4kj,x XK, 8X4 <K, xY),4,pT jd(altltq8l8fll^gq8l8l8lt9(l8lM@ e [pP/6 kP/kP:kP+kP-p4l8jltc$4(kjlM@ e [pX/6kX/kX:mkjl8p4kjl8p4 jd$9(l8lM@ e [pH/6p2kH/kH:p2u kHk6ul8j9(l8lM@ e [pH/6kH/kH:\p2ep2sp2k2l8jl8k4c ;,4kj,x XK, 8X4 <K, xY),4, jd I'c:`N4l8,x XK, 8X4 K),46-h4l8,x XK, 8X4 K),4-d4l8,x XK, 8X4 K),4i \8b 8l\xX,4,`@ `@RrU $`$`$`$`$!`,I`aAnrU 0 Y I q )q  4 '8d0'8, Determine if an embedded object was opened. 6   4   It was, so enable its button. HlJChemFormatCKTSUL (!B!D%F.2 2 2(N%k0k(k $ 8 : Look everywhere for the menu item, in case user moved it. HlJChemFormatCKTSUL (!D%F.. , Don't try to enable it if it doesn't exist. . 8 .(N 8'$k k 6' 4'|:o0H Initialize counters such that an embeded document would not be spotted. (!<!>' @!>'% T'R* Needed when addin is loaded.%'$F 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(y@@1YAH 9 ` EyO< , $b 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 kr6d,btxhd\7ptx$ x ,t lp4)xt(px$ 0x lp6x$x$ PQx[t$ t >, L (u {>݀PWK$*=h8+3qWK$xWK$WK$MED @SS S`( 0>"PLLLLLLPL @ /x%% %*'D@b4@b06@B"X<@ *`|k( ,0`Hk,-- 3t`4r`6pSW`8n ic P`Hpk0B PX00(%`@($ ) 0(@TR$,cu@x atWD@t @p Clas`0(@H$@h e@Hd @` @\ e@xL @< Fe@, @ @ E ex,be et eHP0XT4x´? *\R1*#17c$*\Rffff*193fb4c2bd*\R3*#92*\R1*#c0*\R1*#17b*\R1*#c1*\R1*#c0*\R1*#c5*\R1*#d1*\R3*#30*\R1*#c6*\R3*#4d*\R3*#51*\R3*#50@HJ 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 button2000.d is enabled.Mic\- Previous number of open documents & windows.8C]@]@ Chemistry Formatter button]@0 Toolbar containing button.]@(/ Index position of button on bar or popup menu.]@X Enabled state of the button.}E] İPA@,oP]]]]]:. Determine how many windows contain documents.7 Not so easy, because embeded documents are included in* documents.count, but don't have a window. (!<!>'6 @!>'4$(b xtD H@1rU T$`($`,$9`0  @Dnw0* pHdChemFormatWD2000kTSub- & superscripts cRical f\ulas; c onver6* to , --->a __SRP_5 2_VBA_PROJECTdir6{__SRP_0 lBlockRanges nRangeCount#lLastEnd' lCurrentStart*[ lCurrentEndrRngxdRange bInTable3vcCellhCellnSTART"nnEND9 ErrorHandlerOScreenUpdating!  AutoCorrect% ReplaceText!/ SelectionZ ActiveWindow+ViewI wdPrintView( wdWebView) ShapeRange TextFrameHasTextP(ChemFormatRange& TextRangewdSelectionBlock@StartDisplayStatusBar ScreenRefreshA  Charactersrg StatusBarʜ vbOKCancelx?vbCancel'SetRange wdSelectionIP Paragraphsf Information wdWithInTableTRowsUwdEndOfRangeColumnNumberxOwdStartOfRangeColumnNumber7wdMaximumNumberOfColumns*CellsLastbhCollapseu Direction&wdCollapseStart| MoveRight wdCharacterFontU Superscript SubscriptV rngSelectionlCharacterCount  lInitialEndsText lRngStartX1lRngEndKsFindanAscChar{nAscNumbSubscriptRegionobSuperscriptRegionsCharFollowingPnAscNumFollowingTbFollowingCharNumeric:bFollowingCharSpaceT sCharPrev nAscNumPrevhbPrevCharNumerickbPrevCharSpace6 s2ndPrevCharnAscNum2ndPrev<b2ndPrevCharNumericT#b2ndPrevCharSpacexhlPosE= nAscDecimalnNumLen bNumBeforeAsc!uMove>yMoveEnd*FindnClearFormatting)Forward MatchCaseMatchWholeWordXMatchAllWordFormsMatchWildcardsWrapWy wdFindStop'fExecuteYFound+ InsertSymbolcharacternumberunicodeWChrK~ vbTextCompare Q InsertAfterq5InStrRevĈ InsertBefore.ClassDocumentChange4 InitializeNItemzDocumentjModule1b _B_var_Chr\; _B_var_LeftQ _B_var_Midp`  W  6@pretty arro@w, 1E5exponentiEnotation@pub- &s perscip*t hm"i al+fo!m1la#;c nv * t " ,-5-> ap#e3tyarw1E5# exHojn0ni *s2d.l8 f\*\G{20430-C0046}#2.0#0#C:\WINDOWS\SYSTEM\StdOle2.Tlb#OLE AutoeC"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 istryG C%erF(r@a2 ߀! ButtonEnablerGA%tA^Eba@yUrN&2\//݀e'(rU~~~~~u a   kSub- & superscripts chemical formulas; converts * to , ---> to a pretty arrow, 1E5 to exponential notation A rngam  *\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.1#0#C:\Program Files\Microsoft Office\Office\MSWORD9.OLB#Microsoft Word 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 exponential notation´? >ThisDocument1?3fb4c31bThisDocument>ChemistryFormat183fb4c2bdVChemistryFormat߀0ButtonEnabler193fb4c2bdButtonEnabler݀0P0WK$WK$WK$0F Wordk VBAWin16~Win32MacVBA6# ChemFormatWD2000stdole`Officeu ThisDocument< _Evaluate ButtonEnablerAAXZqmnDocCountPrev6mnWinCountPrevJ  msToolbarվ mnControld mbEnabledXAppt Application*App_DocumentChangeB EnableButtonCcbcFormatButtonCommandBarButton9cbcEmbededButton"K nWinCountٿ nDocCount\HbEnableߕ ErrorHandler3  DocumentsCount0vWindowsdActiveDocument\ CommandBars  FindControl mmsoControlButtonnID]Tag&Enabled۪Class_InitializenCustomizationContext΀NormalTemplateq ChemistryFormatUu mbReplaceText(Class1+ (sAPP_NAME (sLAST_UPDATED.+(AutoExec ButtonAdd7(AutoExit ButtonRemoveSsDecimalPositionsVersiono cbcButton sThisNameU nThisIndex˅ad~\AddInex sAddinNamesBarNameu nControlIndexZBcb\ CommandBar bFoundParentª bAddedDoc1AddButtonErrorWValVersion InternationalwdDecimalSeparator@MsgBoxRvbCr$vbTabc9vbOKOnly TemplateshAddInsIndex InstalledPath2DeletexCustomDocumentPropertiesޖValueKErroNumber-ClearControlsKAddrCopyƿBarwBeforemsoBarTypePopup-~Visible Description sToolbarnControlRemoveButtonError5ParentMacroContainer>Save(ChemistryFormatter& nViewType lCharCountbShape[shpShapebStatusBarWasDisplayed NevChr%*nResult  DThe latest version can be found at 6spectrum.troyst.edu/~cking/VBE6.DLL E S   ( 0CustomDocumentPropertiesSave rThis occurred while removing the button from the toolbar. WK$ F WK$ FDocument @I Fb F Fu F F F F StartEnd 2Finding lines in block:   lines found) The Chemistry Formatter cannot handle more than 500 lines in a block selection., You have selected more lines than that. Only the first 500 lines will be formatted. ,Line left to format: X FW FL FN F] F VThis occurred while formatting a selection. *  F ^u61664 Symbol -->   E  10  x `  i  x    q__SRP_1DPROJECTwmKPROJECTNsCompObjXjSelection 1  (App I 8 y!H=ThisDocumentThisDocumentChemistryFormatChemistryFormatButtonEnablerButtonEnablerID="{57AF180C-4BDC-11D7-B4B5-00A0241A1395}" Document=ThisDocument/&H00000000 Module=ChemistryFormat Class=ButtonEnabler HelpK*mrU~~~~~~~~~~~~~~~~~~= 1 WK$  a !a iaa  q    ThisDocumentChemistryFormat ButtonEnablerChemFormatWD2000 &Chemistry Formatter March 1, 2003F@C:\PROGRAM FILES\COMMON FILES\MICROSOFT SHARED\VBA\VBA6\VBE6.DLLVBA  1` F4C:\Program Files\Microsoft Office\Office\MSWORD9.OLBWord*=h8+3q )Qp0FC:\WINDOWS\SYSTEM\StdOle2.Tlbstdole aL-[DR?C:\Program Files\Common Files\Microsoft Shared\Office10\MSO.DLLOffice AiAutoExecAutoExit ButtonAdd ButtonRemoveChemistryFormatterChemFormatRange^ F +=h8+3qWK$WK$!=h8+3qClassPgv3+3o VBInternal q  FAppp FApp_DocumentChange EnableButtonClass_Initialize T8DD F F1 Y 1  11 XP 2000 97   Jspectrum.troyst.edu/~cking/ChemFormat$ This version of the Chemistry Formatter requires Word 2000 or later.   NYou are currently using Microsoft Word  . $ Versions of the Chemistry Formatter for Word 97, Word 2000, Word XP,  Rand Mac versions of Word are available at HWrong Version of Chemistry Formatter ChemFormatCKTSU F F Fj F F~ F Chem Format Word ^An attempt is being made to load a second copy  ControlIndex fĤIx8< F ^of the Chemistry Formatter. The first copy is:   , stored in :The add-in trying to load is: tThis add-in will not be loaded, so as to prevent problems. DChemistry Formatter Already Loaded F ToolbarName Value Formatting Fa Fl F ChemFormatk F BAn unexpected error has occurred: Error number  jThis occurred while adding the button to the toolbar. FLet me know and maybe I can fix it.R F  8Chris King, cking@troyst.edu Last Updated: File="" Name="ChemFormatWD2000" HelpContextID="0" Description="Sub- & superscripts chemical formulas; converts * to , ---> to a pretty arrow, 1E5 to exponential notation" VersionCompatible32="393222000" CMG="BCBE0177018705870587058705" DPB="C8CA758676867686" GC="D4D6699F79AA7AAA7A55" [Host Extender Info] &H00000001={3832D640-CF90-11CF-8E43-00A0C911005A};VBE;&H00000000 [Workspace] ThisDocument=22, 22, 516, 265, C ChemistryFormat=44, 44, 420, 210, Z ButtonEnabler=0, 0, 0, 0, C   FMicrosoft Word Document MSWordDocWord.Document.89qObjectPool