ࡱ> +.*G  bjbjَ " ]  G $22      2 To 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 97 or later for the PC, and Word 98 or Word 2000 for the Mac. Detailed instructions are given at the HYPERLINK "http://spectrum.troyst.edu/~cking/ChemFormat/index.html"Chemistry Formatter web site. Chris King February 23, 2003 STUqr0JjU jUtu 1h/ =!"#$%DyK yK phttp://spectrum.troyst.edu/~cking/ChemFormat/index.html [4@4 NormalCJ_HmH sH tH <A@< Default Paragraph FontJJ Answers $h5$7$8$9DH$^ha$ B*phD>D Title$@&a$5CJ KHOJQJF"F Test Item! h8hx^h`D"D Test Item indent h^222 anchors$a$ B*ph&B& narrowdBOQB MTEquationSection<B*CJph.U@a. Hyperlink >*B*ph  TqXH  or$-3HޮAb$uRZԳ/=ōb$%~J(v H֓w\"$ WIe]Hd2b$I<<-)&tTb$ʵ UiviT@ 0(  B S  ?CILAsst. Prof. Udo Schnupf, PhDAsst. Prof. Udo Schnupf, PhDAsst. Prof. Udo Schnupf, PhDAsst. Prof. Udo Schnupf, PhDAsst. Prof. Udo Schnupf, PhDBenjamin BatemanChristopher KingAsst. Prof. Udo Schnupf, PhDNC:\Program Files\Microsoft Office\Office\STARTUP\Chem Formatter Word97&Mac.dotAsst. Prof. Udo Schnupf, PhDNC:\Program Files\Microsoft Office\Office\STARTUP\Chem Formatter Word97&Mac.dotAsst. Prof. Udo Schnupf, PhDNC:\Program Files\Microsoft Office\Office\STARTUP\Chem Formatter Word97&Mac.dotVVV % u   ChemFormat ChemFormat2Y,2e,2e,2e,2e0( Chemistry FormatterChemistry Formatter applies sub- and superscripts converts * to " ; makes arrows elegant converts 1E5 to exponential notationChemFormatCKTSUstorage"ChemistryFormat.ChemistryFormatter( p(<<<<<%%II7u- q     'ChemFormatWD97.ChemistryFormat.AutoExec'ChemFormatWD97.ChemistryFormat.AutoExit1ChemFormatWD97.ChemistryFormat.ChemistryFormatter'CHEMFORMATWD97.CHEMISTRYFORMAT.AUTOEXEC'CHEMFORMATWD97.CHEMISTRYFORMAT.AUTOEXIT1CHEMFORMATWD97.CHEMISTRYFORMAT.CHEMISTRYFORMATTER@`@GTimes New Roman5Symbol3& Arial"hZr<V  <V !x20daChemistry Formatter Add-inChristopher KingAsst. Prof. Udo Schnupf, PhD Oh+'0<    $,4Chemistry 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 Word97&Mac.dotchAsst. Prof. Udo Schnupf, PhDch385Microsoft Word 8.0n@ [NW@+wZ@(փ<V ՜.+,D՜.+,\ hp  Troy State Universityro    Chemistry Formatter Add-in Title8 _PID_GUID _PID_HLINKS ToolbarName ControlIndexAN{11F472B7-4744-11D7-BA97-0060083A745D}Ah*8http://spectrum.troyst.edu/~cking/ChemFormat/index.htmlont  !#$%&'(),-02345678R:;<=>?@ABCDEFGHIJKLMNOPQ1STUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~Root Entry F G\`S/@ Data 1TableWordDocumentSummaryInformation(DocumentSummaryInformation8"Macros02VBA 0%;D<@ThisDocument ChemistryFormat 91ButtonEnabler _VBA_PROJECT  "#$%&'()*,x>>#+ (SLSS<N0{00020906-0000-0000-C000-000000000046}8($HME xAttribute VB_Name = "ThisDocument" Bas0{00020P906-0C$0046} |CreatablFalse ^PredeclaIdTru "@ExposeTemplateD0eriv$eCustomiz2 doesn't97* appear in the list of available toolbars.& CustomizationContext = Templates(1), CommandBars("ChemFormat").Enabled = False Templates(1).SaveEC> The position of the button is stored in "DocumentProperties".EB; 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:=False}MacroContainer.CustomDocumentProperties.Add Type:=msoPropertyTypeNumber, Name:="ParentType", Value:="0", LinkToContent:=FalseuMacroContainer.CustomDocumentProperties.Add Type:=msoPropertyTypeString, Name:="Tag", Value:="", LinkToContent:=False0-vMacroContainer.CustomDocumentProperties.Add Type:=msoPropertyTypeString, Name:="Name", Value:="", LinkToContent:=FalseTAAMacroContainer.Save ' They aren't accessible until it is saved.Y$ Initial location of toolbar button.044Z@Z@ AutoCorrect statusm FB (If on, the wingding arrow is replaced; if off, --> is replaced.)Z@0Z HZ$Chemistry FormatterhZ$February 23, 2003i# Add the Chemistry Formatter buttonA@*E Start the module that controls whether or not the button is enabled. . /,l01 Unload the "handle button enabled" class module. /, . & Remove the Chemistry Formatter buttonpA@2l6 Adds the "Chemistry Formatter" button to the toolbar. >ZXZxZZZZZZZ0ZHN> If the button is already present, delete it. (This cleans upl> if the user created a duplicate, or, perhaps, if the computer crashed.)= This doesn't find the button in the storage toolbar; thatRpD button has a different tag. ƞ TnVChemFormatCKTSUX .!P%R.40 40? Check to make sure the add-in isn't already loaded (perhaps as) a different version) k$Z!'8kj$Z!$\!^':0 < \o <!`2 <!'@8k @Chem~  @Format~  @Word~  <!^ :1 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 d/of the Chemistry Formatter. The first copy is: d  @, d stored in d  <!f d dThe add-in trying to load is: d  8, d stored in d $Z!f d d:This add-in will not be loaded, so as to prevent problems. h"Chemistry Formatter Already LoadedA@b, Don't run the rest of this install routine.%E :$\(`uhhh < 4B@jh`. Retrieve the previous location of the button.e$Z ToolbarName7l!n'0 ControlIndex7l!n'En Make local copies. 'B 'D r'p> Validate the position in case the parent control was deleted.l< B> 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.)@ B .%P.F t!vN F!x  Toolbar exists and is enabled.'J D F!z!| T Prevent control index from being too large (could happen if controls were deleted). F!z!| 'Dx >  P<"<6<> T`:utto <ment$`@`B@D wit F(ollo $`J onta`L rope2#Valu 4kToC$`onta@ rope P Val@ nt:=`onta` rope rope$` Type@ oCon` @ 0pe:=@ :=Fa`onta`rope`rope ="Na$` t:=F onta$@Lcess@Led.`B$ I`Boolb  F) arro$`"s re`$H`&atte@ ry 2`(`*stry@, @. the`0 s wh`2 ton 4. 8@6 1 U`8 tton`: le. <(.  @> Form`@ `B 6 A Dorma h@F  >`H `J `L0@N > I@P ady @R (Th`T > iPME!- @ D@ F 0 , 20 h  D B  8  P | |X H  ( *0`h p H   "(  *0`  Lh  " 8   ,(X` "h <p   D DP  D &D  ` Fp       0  P@  8 8  P( 2 H X `  h  p  x    4   ( 0PX ` Dh  D < lH   & ( 0 ZP      < ` 6h  *J  p   @ (8@  0Hx  B .@0&p : B  0 @PX `hx  HXp"x H  D P` $h *    0( 0 P px H 4p " L H *P   $( (P *x , * B 0P2 0: 8:P6<* 68 Bp :  2! 8!,H!8x! <! ! " " 0" 8"  X"  Nh" 4" " # @# 2H# J### # *$ 8$H$X$p$ x$ $ $$ $ .$ H$ % F0% Fx% "% % % & &  & (& 8& H& X& h& p& & & :& :&  ' 8'H'`'p':' '' ( ( (((((()) )  ) 08) h)$) ))*) )* * 6* *P* z* + + + , + P+ :X+ ++ + B+ B, <X, ",2, :, 08-jh---- - :- @8. x... . . . . . B. :8/ >x/ 0/@/8(0 ,`0 000 >0 >1 :X1 *1B1 2 2(2 02 82@2H2 `2 p2 x2H2 H4 X4" `4 Lh4 J4 J5 JX5 "5 ,526@86*x6 866 ,6.7FH7H7 87.88@86x8 :8889 J9X9`9h9 p9*9J94:L@:6: :: L:@;  X; Hh; 4; 2; < 8< >H< < 4<< 4< "= @= >P= 4== = = D= @> H> P> X> `> h> p>x>> > > :> L? &P? x?? D? ??? >? L0@ 4@ "@@ @ @ AA A(A0A8A@AHAPA 6XA A A A A ^A ZB 2xB&BB BB C CC 2C PC `C hC pC&xCCCC CC C CCD PD XD JhD LD NE XEhEpE$xE E 6E EE FFF :F XFpFxFF F hF vG GG GGG NG ,H 8H PH hH H H H H H H H H I  I @I `I pIII&I &I J J (JHJ `J 8hJ 8J J :J <0K pK K"K0KLKHLPLXLpLxLLLL L LL 8L @L p(M LM M M M NN N N N "pN 8NNN`O hO lpOLO 0P8P@P &HP pP 6P &P P P P Q Q Q 0Q@Q`QpQ 4QQ QQQ Q Q R(RHRXR 2xRR RRR R RS(S8S 6XSS SSSS S 2S <T @T HThTT 2TTT .T U 8U 8HU U <U 6U2VPVXV 2xVVV >V B(W 6pWWWWW 2W .(X 4XX 4X 4X Y , YPY 4hYY :Y YlZ!h[![[[[[[[ [ [[ [ R[ :8\ x\ D\\ <\ ,(] X] ,x] "] j] 2@^ 4x^ .^ &^4_@_X_ x__ 6__` @`H```h` p` 6` `"``a a (a 28a pa"aaaaaaa 0a b(b0b 8b $@bhbb b b <b0c8cXcxc c c cc cc: 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 h0h(a  tB@~Nhh Use defaults6 Can get here if user deleted button or its container. J/ Place the button after the "Justify" button on the "Formatting" toolbar. Formatting'B# Find the "Merge & Center" control. B .%P.F Tn{V F%R.4- Find the "Justify" control. 4 'Dap 4!^ 'DhP hH : In Word 2000, the template's toolbar isn't exposed unless a document is open. !| .!B@'Lh * Ensure that the button position is valid. D F!z!| F!z!| 'DhH < Create the chemistry formatter button. It is stored in the' "ChemFormat" toolbar of this workbook. F D ChemFormat .%P%zB@ChemFormatCKTSU D F%z(X3 Make sure the command bar containing the chemistry; formatter icon is visible so that this add-in can be used. F!n  F! F(h h L$B@Bh ux Np #)17!An unexpected error has occurred: d  Error number  t!v d  t! d 5This occurred while adding the button to the toolbar. d d#Let me know and maybe I can fix it. dChris King, cking@troyst.edu d dLast Updated:  & d d"The latest version can be found at d spectrum.troyst.edu/~cking/ h $A@b Keep tryingl`B Removes the toolbar button and saves the location, if it changed.ZZZ Find the button. r'p TnVChemFormatCKTSUX .!P%R.4 4 45!'" Command bar name # Record its position and delete it.5^'C@jn(h     ) Button was moved. Save its new location   ToolbarName7l(n  ControlIndex7l(nC@nhxuph #)17!An unexpected error has occurred: d  Error number  t!v d  t! d 9This occurred while removing the button from the toolbar. d d#Let me know and maybe I can fix it. d#Chris King, cking@trojan.troyst.edu d dLast Updated:  & d d"The latest version can be found at d spectrum.troyst.edu/~cking/ h $A@b. If error occurs, exit without doing anything.lPE 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@trojan.troyst.edu# phone: (334)670-3576< home page: http://spectrum.troyst.edu/~cking/Z0$" View: Print layout, normal, web.ZH$# Number of characters in selection. Shapes.Z`$! Indicates selection was a shape.Zx$+ For iterating through shapes in selection. Block selection.Z', True if status bar is originally displayed.Z$( For iterating through lines of a block.Z$- For enumerating the characters in selection.Z$ Holds msgbox return value.Z' Ranges in block selectionZ8$4 Number of ranges (blocks of contiguous characters).ZPh-& Start & end positions of a character.ZZ$# Holds ranges sent to be formatted. Table.Z$ Is the selection in a table?Z$* For iterating through cells in selection.Z Indices for lBlockRanges array. Needed for Word 97.Z Z8 .!!|Fug .(H Determine if AutoCorrect is turned on. This is used in ChemFormatRange. to determine which type of arrows to replace. !' : 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. !!n'    5n  $ Format text within selected shapes. 5 !! !!A@h 'hhh`  ' Block selection (made using alt-mouse) A This is about 7 times slower to process than a normal selection.5n  ? 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@ .(h 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. dTYou have selected more lines than that. Only the first 500 lines will be formatted.  $$b'    .( .(u arhhh '    + * Format each line of the block separately.  Line left to format: '5.   $  $C@ A@n  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.  .(h % Normal selection, or cells in table.a 4 If nothing is selected, select the whole paragraph.5n 7!B@Jh8 ; 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!| 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  7 B. Not all of the cells in the row are selected.'hhh 3 Format cells in a table. This is slow to process. 9 Takes about a second per cell on an old 200 MHz Pentium.  5  !A@   Normal selectiona05A@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! d3" If the end-of-paragraph character3& is selected, then the whole paragraph3 is selected (probably). C@   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(01 So the user won't be typing sub or superscripts.5(h h h h h n Selection .(u  #)17!An unexpected error has occurred: d  Error number  t!v d  t! d +This occurred while formatting a selection. d d#Let me know and maybe I can fix it. d#Chris King, cking@trojan.troyst.edu d dLast Updated:  & d d"The latest version can be found at d spectrum.troyst.edu/~cking/ h $A@b .(l PF 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 10-7.Z' Number of characters in rangeZ'# Character position of end of rangeZ'1 Holds selected text for sub/supscript processingZ' Character position counterZ'* Start & End of range, so it can be reset.Z0ZH' Character at current positionZ`' Ascii number of that characterZx'7 Indicates a character is in a region to be subscriptedZ'9 Indicates a character is in a region to be superscriptedZ'& Character following current characterZ' Ascii number of that characterZ') True, if following character is numbericZ'( True, if following character is a spaceZ'' Character preceeding current characterZ0ZHZ`Zx'7 Second previous character before the current characterZZZ 1E5 --> 1 10^5Z' Position of E in selection.Z'; Function return value--gives number of characters deleted.Z'& Ascii number of the decimal characterZ('= Number of characters in a numeric field that follows an "E".Z@'' True if a number field preceeds an "E" !!|'" " FugE Some countries use a comma instead of a period as the decimal point. Z .%X$V'P "B 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* (f 8 Move insertion point after inserted character, and end.  %\'u+ Nothing else to do, if just one character.h . Replace the arrow made by typing --> with the prettier Symbol font arrow. !'$8 Find doesn't work on a 1-character range, so extend the- selection by one character before searching.  %^' !`C@b^u616649f- The unicode number of the arrow in Wingdings9d9f9h9j9l p9nC@rn !`!t  An arrow was found. ! $ 4 The arrow is the selected character, so replace it, E and exit. (The alternative is that the 2nd character is the arrow.)Symbolxz B@vhhx= The rest of this procedure requires more than one character, so quit.uh7 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.' !'( !'* !`C@b9d9f9h9j9l p9n  / AutoReplace is active; replace Wingding arrow.^u616649f\X>C@r5tW find.replacement can't be used because it causes the whole document to be repaginated.T Repagination took 16 seconds on a 90,000 character document on my 200 MHz computer., The InsertSymbol method doesn't repaginate.Symbolxz B@v ( * B@a=q=h<<a< , AutoReplace isn't active, so replace "-->".-->9f\<C@r5tSymbolxz B@v * '* " '" ( * B@a <q<h<<h<n;J ***************************** Replace * with ************************** !f'&D 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.'\:  & $|$|~'  &  $  &  $'&  'a:q9h993 Replace all occurrances of asterisk character with centered dot.'\9  &* ~'    %B@?G On deleting, "Smart copy & paste" deletes extra spaces at end of line.   %B@j<S Therefore, insert after, then delete. (Not an issue with later versions of Word.)  'a`8qX8hP8H8G **************************** 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  " & $$V', ,/ ,:  , P Character is a digit or period. 0 , P Character is a digit.  %!(a5 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  " &  $$V', ,  ,  ,. ,  ,A ,Z ,a ,z ,) ,]'0a3  %!(h3a3'0hp3hh3h`3hX3aP3 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 ,) ,]'0a2'0h1h1 H ************************ Superscript Charges ************************** Superscript + & - charges.2 To get here, there must be at least 2 characters.  " & $$V', ,  ,  ,  , R) space, carriage return, tab, or linefeed'2 f UPPERCASE letters lowercase ) ] ,A ,Z ,a ,z ,) ,]b'2h/ 2  43 is +; 45 is -; 32 is space. ,+ ,- / First characterize the surrounding characters.'8* Initialize all to False.':'@'B'H'J  Following character  " &  $'4 4$V'6 60 6: - Following character is a number from 1 to 9.'8 6 b':h.h.  Previous character  &  $'< <$V'> >/ >: , Previous character is a number from 0 to 9.'@ > b'Bh(- Second previous character  &  $'D D$V'F F/ F: 0 2nd previous character is a number from 0 to 9.'H F b'JhH,h@,h8, , Now decide which characters to superscript. 6 Don't do anything if preceeding character is a blank. B Superscript the +/- sign  %!( 8, Superscript a digit following the +/- sign.  %!(a+( Don't superscript a number following ). ) F)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. @ >0E Don't superscipt a zero. H  %!(+ Superscript if previous number is a 1 or 2 >1 >2b  %!(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 O >3 FOb  %!(h(a(+ 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. @ :. Don't do anything if at start or end of line.  "  4Superscript if not followed by an end of word token. ( , . : ; ? ! tab carriage return 6( 6, 6. 6: 6; 6? 6! 6  6   %!('2hp$hh$h`$hX$hP$hH$h@$h8$h0$ L ***************************** Exponential Notation ************************3 Replace any entries like 1.45E-7 with 1.45 x 10-7. "> At least 3 characters are required to hold, for example, 4E7. L " 5 Look for capital E, beginning from end of selection. % Ignore if "E" is 1st or last letter. & L$E % Ignore if "E" is 1st or last letter. & L $$V'6 d Digits + - 6/ 6:  6+ 6-. Character after "E" is a digit, +, or - sign.( Therefore, a numeric field follows "E". Find the length of that field.'R% Must contain at least one character.  L " & $$V'. Digits ./ .: / Still in numberic field; check next character.  L 'Ra: Not a valid number field, so last digit was end of field.  L 'Rrh 0 A numberic field follows the "E". Determine if one preceeds it. & L $$V'>'T >/ >: 'T > Pb, Check that digit before decimal is numeric. L & L $$V'> >/ >: 'Ta('Tha) The word begins with "+E", so ignore it.'Thh T Exponent detected; format it.  L L R   %!(  Insert " X 10"6 For the "X", use the symbol font multiplication sign.Symbolxz L %B@v 10 L %B@  L %B@hhxhp LhXlPHAttribute 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?#@' #5rolIPndexH#9?!esWDNumbe@qDDPar9J 0 eagh_AA ?h!\('t accessible until@s nde OpmExplici@DefInt@ A-Z bIng locbrVE Priv e msZ As> *L AutZrrectatus (If on,sApdp arrowreced; iff, --> .bRTEBeanPub Class1New Blut rdons APP_NAME' ' dverĥ #LAST_UPDATEDFebruary 23, 2003`Sub a$Exec(`;> ӇD2_'2art+moduBthat3se r or n>oF`Set'.App`!@*bDEnd -gitd' U nloadb"h`Ȁd&c4 #Noth`EBg ' Remo>v'  ߹ . 6 ' |!er"0v Dim cbjc *Ct3 !sThisB!Sdnb[;ege,1@ Ip/Bin_m s{m e;c)s W SbFound\6qbpedrHn E=r GoTo2w/Aa/)alrea$dy~es@c, dele it"(A cl?s tup'qC1cta duO%L,/, Phaps,comp ' crashedF@d fi/ n뱋8;@aW%d hadiff`1Xtag/G"= 6.s.F| _@(1u, ID:=1, TagA1LCKTSU"G`48*Is t5f% ' ck.make suia ea?( a`u0&versৣw0|= +81d dIns().D-c EapP3 0 A#}C5 &@n1WordT#P <> CM,NHoaBd+U̿@0!d "" Thlen"['A6mPmand@]sllecdoes Aapopup CNo wdayAfi if @ exPs, or,ao H(coF (wsdP6sometimes "Microsoft Wor~d w@{!o A.FLOn EPrrorVsK a^!Set cbA6AppliW.C >s(e) +A .Numb= 0+`# GoTo |#jB@cb.Ena@dm 5c* @#e#)@@bFound(= Trc +U> b%su+ 10q' PdN>e@x from@ing too l arge ;uld happenBds were U), =H(@hEK7`Clear5 E"' UrdefaultsDC^gJh`b\usDd Qitaontarc!9`4No@i9wPlacÀ afՅ`Jify"f ~ۀ5"5f0qF= "B*'L F|Me<& Cer"me_jDFj#$`qb [ I(Type:=mso5, ID:=123) F4(n IsXtha,-)13e%t?a5Rdz$InBN 2000,^Zt$s'sri2ZexpospunlDes'a ds [BsnWow>mKOws.K5 bedE pr'2su >that T* ls valijk?It =IK]LU C@t3cFfF . Itrpp/¢2F4FworkbolokCede))g py.:=cb, BeP p/" 20'`).TagCpKTSUteE~|2ain0?7$ivi|siPl'cP0@PG0 a< mso@P†7P+PV9+o ,6/bNl5x g  0X}:MsgBox "An \un9@#ehAPoccur%:F"Tabp"b nӅ1kĆo vbcADescrip"RӁ whileA;Pӱ@}bb( "Lnme knDow2mayI fix it.\p)r`"KP, ck`@@yst.eduw$LapUpQd: sLAST_UPDATED 0t vXers)f atsp0rum. /~ /sAPP_NHAMEr!ReV ' Keep %`PrivQ %Remove(0rֱ`hKgDt°avlo,Q@change7Dim1%vAs 7 !S0ngsuG ; c(oЕrH sQ  ¸ate Set cbcButton = Application.CommandBars.FindControl _x(Type:=m so:, ID:=1, Tag:="ChemFormatCKTSU")If $No ~Ishing ThenfpWith|sToolbar.Parent.Name ' 5 n5' Record its posiv t delet*e .n{= @.Index .DEnd VÂIf u!V<> mOr 0  ' was move$d.avUs new lo6CMacra0iner .CustomDocumMProperties("DTQ").Value@W+LK6 S1ROExi t SubQRe>BError:MsgBox "An unexpected e  hLoccurred:" &` vbCrvPbTab" number A 9.N  De`scripBThis " wh`ile rA4t he bufrom t.-M/"LknowBmaybe I can fi^xF=rK@, ck@ {jan.yst0.eduas t Updd: %sLAST_UPDATED*gdNZ lv8ersforugat 3s;rum/~"/",;OKOnly, sAPP _NAMEBD' p#B"0s, eKw out do@ (ythaQNPub aP istrycter( 'ndsb6sc"Ato'Range proc+re xA! ' 7 !a nal ord b {k 5ells in a table,ptext`a?autoshap`c@ |box:'e7L of B`e!Q tip f aDUref*A'it@A spa6cAs qbee!capitPalizw@sCreI byMz'HChUtophrUA*f2 DepartTroy St! UniNtyaphon'(334)670 -3576hospag!htt0p://WDim nViewa3' @7Print iyW,F`, web@* l CharC@jt As Lo`J 0 McaPSrQ?&-$qAbSBIe&:pw/@_Ⴠ#6+ Qka ) shpA+' 6Ker through3N B{2tb1usWasDisplay' ' Tr0nif 2s!us0originally dTN  l`x `f;b=v0.Varia70eie ?rG4nResu lt' Hobl0Kmsg Apht`urn v~lBKs(402, 1 To 2)? $1M|J "nC(av0(r(Rcon`tiguo0) L hQZ-, lCQ~nt r8/,t`AieedvU4 rRP(_ /T s0W 0QRma &![bInmPp4/V4g_?s cC`r ((cUd3@ pynS0TART`nEND2==A`! array@EXeed61W197cwd2KK IntegP]= 3wdWebU On gGo`(H0l2~~ŭs`uP5= 0B 9ScreenrAm= FalssdRDrmp< CApvCocwr 4;  D usPl"dpch tx0ow0o9PKce` mbReT{'.dRS%Dp'ru <&sIa "&$щa ""jdW`Can't`a _#5unlessDmLam ! vqsr`OveW0ow.$.!tU!y(w= ( "0wdkR7 rA 6 u&nEa qIn .e  P.! Frame.Has 3'`tp.TextFrameRange End If XN shp *bShape = Tru vIf NotB ~ ]rEA )^Y`_E|ND7_@@_+ a lJm 8N GeS"FiCl nC: " & )& '"1 (I> 400ɶnResulLMsgBox(", Ch`emist ;Wmat canEdle mo@mB5 Fa&.vbCr`_Ce"YouGvR` t. OnlyBQ@first gwill beMd.", vbOKCancel, sAPP_NAMEӉ")# Y)A@="G_M Exit SubRE^Kn?aH݈o== U?KqMk_8e2lOH?48' S- >eYA%LaPÁsep@telyw` Np6To 1 Step -Bz>L= leftQfatD>N @Set rRo.zWith"=.b :=eNJ, nS rA! ~=  ' Collapse2O'B' Mց{ e?R/i{0s"y   fу5treat?P_%!OfC#JumnN"<)f - 6rtr) OR 1MiskreplaceRwA6"" (1VcHwd dot)e`p6d bXD"-->"T+ a`ettia 5wS15Q y1.43E-7o 10-7P DT 10^5-lPosEdLocb ' ition of E in@ selec.a"nRet ' Fun return value--gives number#0s d3ted2Decimal5'@2cii;HZd RLen' %@@afieldtat follows an "E"-bB} ' True xif CceedE @l¹Cou= rngSdFs. If NGI 3&J, >1&GA@eotRhelEtA*,AZ2onJcC%If<' .varrow m ade b5yp_ !"0 E'AttiSymbolqbf lIn`alE` f@G _8 B8, so 5'!KfſsearcA%.;/u/WaP e ).CrForma#ngIEL^u61664" unico`-'0W/d`sI ward`F)MatchCa A= Fa BWholeWo3Alls@ aildc` @ .WrapwBdStopYExecute% q9!.F@Qd9Pgn *wP>f1<= )>@CS`L%+<@(rJit,W "a.e]. (  alWaBQ[@kN7J3J'IF47Fo nt:="",%:=174, T&:= #1@Srestag@Fs?ocedu\ requi mwJ76';iwoHdg0h@^cn9f@' *MAMsrPPP]PsPF1lbRPtarfjSA&S2A2?H@q_C./C BBs=WBqoBgB;eʂr*1to`ok 16Qs90,0008F domy 2MHz @p0YrULGmethG oKtoK|oloKmKMh 3etRA 6,4kEkqBI 18QLoG*l=)!c)"P"!SP) ({s(sTO lRngEnd = l- 2  lCharacterCount DjrngSelection.SetRangeStart,C nElseExit Do )IfLoop With @ ' * Replace * w 4sTexu ' Tables have an end-of-cell marker that is ced as two Jcs$bye InStr fun, butone inP a r.#(N)%evalua The solu us!@ hereA$to rCboth$CGa sp@L.N1BkB-(N, K, Chr(13) &B7)C&If N > 0%nCYLeft( N - 1" ""@MidG+ 2@ N + &L̗ÔB"'FaooccureXcwof`@iskHaAcen#VdotkJ"* ", vbCompareJʢs.InsertAf# ""B' On duting, "JSStRpy`+paste"`^r>s WZ ` pline D! e wd, 1 fOfore,X a,_e. (Noe_nTsuulBaverssWord.@ǝ@ Subscript Numb@CHam:@pBm scii`.d`,BqbelowC*' 9*"tab"1A& ".Pfeed3c arria@return32 40( V) +4,U5-6.7/8-57 digits 0-9d65-90 uppercaset997-122 !y25 Za '1n1 For=@MTo `pnAscR@ (Ɋ`TJ(f> 47 A&< 5@8) Or &=BDecimal] ' daa$ c"iodjbMReg] >y !ys_=EFont.'0= Tru|}a ls4rConly i/)r tnAfol!"d rJ!dwSagrap S' symboll,5, ap7tslP^vQs@MӎAlso, don'tb W if ck l/_sQwww0}ris.comk 0N <-! 2!.xr.$b%E/> 13026.9 g@5= 65= 9606j9}8>22ɝ841993Ð7= Fa5.q?4?4cd?4xxX o >  yr~ nPpbϰ?.' @c`8@ S4!=")"b]"LPu UPPERCASETsRNg) ] --- - 0q--0ɴ O Z$?#<pS4NN0{_aIg` cG+- &o get aBmust S&le\2#ssu= ~1R[R 9?`b%j, ܝ ablՠU FK 'UPPERCASE letters(lowercase<*)<] ElseIf (nAscChar >= 65 And <= 9 0) Or &971&122':= 41893 ThenbSupqcriptRegion = 0TrueRFIfW)' 43 is +; 45-; 32space.&?{'W3W-' First c acize the surroundings 7bFolNumeric 48J< 58)-`!Ua number from 1A9,A@J)i#~0d]+ : JvEp' Iious?>b4Am=-{=D<:<;;: :0:Z ?:m@"9 8@nf' Seco :p7`?"x> 2_sȅ92v W9h /:v%O:[;` ' @ O ?<HbP;( 9? :o ' Now decide which=s.s7L' Don't do anythtifAceeucblankL!'ot bK./D` ,B|+/- s ig9 rng@Select0.hs(N).Font.o:P? Z 3 a digit fVsQ LO @ pߏ cA'(  7kf ) pӮWo;><`;1?Ew?u1#n!!5 , so)eck''/ +A+-P}R]andt ed byor 3 lesͦ# P'0du !8"Pzeroo:L??*5*p|?*?* CvRjĔa0} 2o{V9E= 50/ CC /+Fa f -"O. 0wilFl' h`(l@e NO3-Wd( HC,CHD3+`(CaYwin 0time.?;& O>3=O % 51p,79_''_]  nd    ' The previous character is not a space, and #' tfollowingnumeric.IfEDbE<ҀYni- or + doesn't need to be superscriPptedlF!e xampln-butanolExceptions: K+(aq), "K+,",!, e&t(NbPCN) Ahnd  FEkSy)XD}' DoAdoayth{if at sPtartKe@of line8)N < lœ CountB(N X> 1_#$Sa O@"ájby@) $wornkeno%(,].w;W ?E!tabcarriage retur[? 60nAscIG <> 406R4WR6V58W9V63V3W 13?Pc*rngSele cv.Ys(N)@.Font.iT= FalseC EbReg ˟E@pIfZ ]4n Next N  ' * Exponentiatl a2V#' Repl @ trieske 1.45E-7 with x 10-7Ç`a->= KF' At leastFs ar!nquirhold, rf4E :l0PosE?mTo 2 Step -1>' LookB capit!E,ginnafromQs+ 0Ignop 0U"EZ"1` l let@TMidH(sT, ,x 1) @E'> PE= H(Mz1)'/Digits+-+(N R7oJ!< 58) Or  43`0= 45?J' 1fH afDa Bd, +,z-P sigq br*e )e f0ieldP%qs   K' FiHleng3AAfter ("@)@b"Q OmF$ ASub sBar ScreenRefreshA  Charactersrg StatusBarʜ vbOKCancelx?vbCancel'SetRange wdSelectionIP Paragraphsf Information wdWithInTableTRowsUwdEndOfRangeColumnNumberxOwdStartOfRangeColumnNumber7wdMaximumNumberOfColumns*CellsLastbhCollapseu Direction&wdCollapseStart| MoveRight wdCharacterFontU Superscript SubscriptV rngSelectionlCharacterCount  lInitialEndsText lRngStartX1lRngEndKnAscChar{nAscNumbSubscriptRegionobSuperscriptRegionsCharFollowingPnAscNumFollowingTbFollowingCharNumeric:bFollowingCharSpaceT sCharPrev nAscNumPrevhbPrevCharNumerickbPrevCharSpace6 s2ndPrevCharnAscNum2ndPrev<b2ndPrevCharNumericT#b2ndPrevCharSpacexhlPosE=nRetL nAscDecimalnNumLen bNumBeforeAsc!u InternationalwdDecimalSeparator@Move>yMoveEnd*FindnClearFormatting)Forward MatchCaseMatchWholeWordXMatchAllWordFormsMatchWildcardsWrapWy wdFindStop'fExecuteYFound+ InsertSymbolcharacternumberunicodeWChrK~ vbTextCompare Q InsertAfterq5 InsertBefore.mnDocCountPrev6mnWinCountPrevJ  mbEnabledXApp_DocumentChangeB EnableButtonCcbcFormatButtoncbcEmbededButton"K nWinCountٿ nDocCount\HbEnableߕ ErrorHandler3 ActiveDocument\Class_InitializenDocumentjModule1b`#    6dir\PROJECTwmPROJECT !yCompObj+jX0* pHdChemFormatWD97kLSub- & superscripts cN@ical fXulas; conver6* to , --->a pretty arrow, 1E5exp@onentiEnotation@pub- &s perscipt hmi al+fo!m1la#;bcnv * t " ,ŀ-5-> *ap#e3t*yarw1E5 exHon0ZniY> %<stdole> s2d.l8 {*\G{00020430-C0046}#2.0#0#C:\Program Files\Microsoft Office\STARTUP\StdOlea^  *\G{000204EF-0000-0000-C000-000000000046}#3.0#9#C:\PROGRAM FILES\COMMON FILES\MICROSOFT SHARED\VBA\VBA332.DLL#Visual Basic For Applications*\G{00020905-0000-0000-C000-000000000046}#8.0#409#C:\Program Files\Microsoft Office\Office\MSWORD8.OLB#Microsoft Word 8.0 Object Library*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\Program Files\Microsoft Office\Office\STARTUP\StdOle2.Tlb#OLE Automation*\G{2DF8D04C-5BFA-101B-BDE5-00AA0044DE52}#2.0#0#C:\Program Files\Microsoft x> PSS S<.<6<<<N0{FCFB3D2A-A0FA-1068-A738-08002B3371B5}(($` `ft`.0@ er o` indo $*-matt F- p05$ 0-$`8.`ro` \Mols MEN J P hp 4x "*>,X   " "  4 >  0`   2& $8 H`      @D0 2x       " Nh x,R(C This module controls whether or not the Chemistry Formatter button#M is enabled.Y- Previous number of open documents & windows.,@Z@0Z@H Chemistry Formatter button lxZ@` Toolbar containing button.Z@x/ Index position of button on bar or popup menu.Z@ Enabled state of the button.Z İA@lPZXZxZZZ. Determine how many windows contain documents.il7 Not so easy, because embeded documents are included inT* documents.count, but don't have a window. .!!|' !|'t  y'a0', Determine if an embedded object was opened.as;     -  It was, so enable its button.ow TnVChemFormatCKTSUX .!!P%R. i (x593h0h(h  f9: Look everywhere for the menu item, in case user moved it. TnVChemFormatCKTSUX .!P%R., Don't try to enable it if it doesn't exist.   (x 'h h ' 'ulH Initialize counters such that an embeded document would not be spotted. .!!|' !|' r'p* Needed when addin is loaded.'F This assumes the button was initially enabled on the storage toolbar.A@lAttribute VB_Name = "ButtonEnabl er" Bas0{FCFB3D2A-A0FA-1068-A738-08002B3371B5} |CreatAFalse ^PredeclaId#ExposeTemplateDeriv%Customiz E ' This module controls whether or not  Chemistry Formatt"!ed. Option \licit DefInt A$-Z' {vious numb4f open documents & windhows(Pmq mnDocCount As *@eger WSu4b _@YBaChange() 2 End> I Dim cbcA!CommandB,ar E@ded] nyƀF_NDR)OTrr/GoTo E-AH  3' De@]mine how y%Se AV 7 %' Nfso easy,@ becauech\~ inclu@f`.cA] utn't have a -=a7;.e8s.wab &=@CkIDf > 0@en`'= Tru@E™@Ǥ'if `W object was"e@~+ 1 AO_%mybThg  qb, 3" iFg`qCSet!W RK,A @' Look everyre fm!`/em,@_ c͠dr`it[@$1j 1lj7/.ohm,o8pt=# %`-i9esex0r   R8U=?\4= Cs _x4_R:T1a Cla ss_Inpoal|izdp0T|ers suchatfBЌP wouldˆbe spoC (n_PsBP qra:extHNlqxNedn a ddin loaNS Yq6qP= vsGP`tially 2rage tCv(yOffice\Office\STARTUP\MSO.DLL#Microsoft Office 10.0 Object Library Sub- & superscripts chemical formulas; converts * to " , ---> to a pretty arrow, 1E5 to exponential notation>Y> >ThisDocument 23e593e04*D>+ChemistryFormat 153e593ef9*D ButtonEnabler 163e593efa*D#8X 8rDG`:t]`rDG`:t]rDG`:t]DWordkVBAWin16~Win32MacChemFormatWD978gstdole`Officeu ThisDocument< _EvaluateChemistryFormatUuAXZq msToolbarվ mnControld mbReplaceTextClass1+ ButtonEnablerA sAPP_NAME sLAST_UPDATED.+AutoExec ButtonAdd7Appt Application*AutoExit ButtonRemoveS cbcButtonCommandBarButton9 sThisNameU nThisIndex˅ad~\AddInex sAddinNamesBarNameu nControlIndexZBcb\ CommandBar bFoundParentª bAddedDoc1AddButtonErrorW CommandBars  FindControl mmsoControlButtonnID]Tag& TemplateshAddInsIndex InstalledMsgBoxRvbCr$Path2vbOKOnlyDeletexCustomDocumentPropertiesޖValueKCustomizationContext΀NormalTemplateqErroNumber-Enabled۪ControlsKCount0vClearWindowsd DocumentsAddrCopyƿBarwBeforemsoBarTypePopup-~VisiblevbTabc9 Description sToolbarnControlRemoveButtonError5ParentMacroContainer>SaveChemistryFormatter& nViewType lCharCountbShape[shpShapebStatusBarWasDisplayed NevChr%*nResult lBlockRanges nRangeCount#lLastEnd' lCurrentStart*[ lCurrentEndrRngxdRange bInTable3vcCellhCellnSTART"nnEND9 wdPrintView( wdWebView) ErrorHandlerOScreenUpdating!  AutoCorrect% ReplaceText!/ SelectionZ ActiveWindow+ViewIwdSelectionShape ShapeRange TextFrameHasTextPChemFormatRange& TextRangewdSelectionBlock@StartDisplayStatu2.Tlb#OLE Autom@* *O f@ge *2DF8D04C-5BFA-101B-BDE5*AA) 426*MSO.DLL# 4 10.0 Object Library#>YThi@sDocum@N2@ThQwsDccmEDHB1Bv+B,B>"B+BistTry2@dCeAr@F@!r@a@O /!b% ButtonEnabler 7J2t a[E_a`vi!Rr/mJc(` bThisDocumentThisDocumentChemistryFormatChemistryFormatButtonEnablerButtonEnablerID="{050A9517-604D-444B-97DE-2A26E97DA233}" Document=ThisDocument/&H00000000 Module=ChemistryFormat Class=ButtonEnabler HelpFile="mac standby:Microsoft Office 98" Name="ChemFormatWD97" HelpContextID="0" Description="Sub- & superscripts chemical formulas; converts * to , ---> to a pretty arrow, 1E5 to exponential notation" CMG="F5F74F0BB3C1B7C1B7C1B7C1B7" DPB="B4B60ECF728F738F738F" GC="7D7FC7F059B85AB85A47" [Host Extender Info] &H00000001={3832D640-CF90-11CF-8E43-00A0C911005A};VBE;&H00000000 [Workspace] ThisDocument=22, 22, 516, 265, C ChemistryFormat=88, 88, 592, 325, C ButtonEnabler=66, 66, 570, 303, C   FMicrosoft Word Document MSWordDocWord.Document.89q