Skip NavigationDesign Science: How Science Communicates
Products Solutions Store Support Reference Company View Cart
 
 
TechNote #54: Last modified: 10/20/99
Last reviewed: 07/04/01

Installing MathType 3.1 Macros into Microsoft Word 97 for Windows


The information in this document applies to:

MathType 3.1 (Win)

Microsoft Word 95 (Win)
Microsoft Word 97 (Win)
Microsoft Word 2000 (Win)

Issue

With the release of Microsoft Office 97, many MathType 3.1 users are noticing some problems with some of MathType's special commands for Word. This document will explain what some of the problems are and how to correct them.

Note: There is a newer version of MathType that addresses all the issues listed within this document. We highly recommend that you upgrade your copy of MathType.

Microsoft Word 97 operates differently than earlier versions. If you would like more information about these changes and how they will affect you the MathType user, please read our notice Using MathType 3.1 with Office 97.


Solution

If you previously had Word 95 and installed the MathType macros under that version of Word, you may begin seeing an error message in Word 97 whenever you open a new or existing document or whenever you try any of the other macros. This error is caused by the MathType macros used for preference file attachments that, while they worked under Word 95, no long function correctly under Word 97.

When you launched Word 97 for the first time it automatically copied and converted all the macros associated with the Word 95 normal template to the new macro language, Visual Basic for Applications (VBA). The conversion is the source of the problem.

The following will give you the step-by-step instructions needed to correct the problem without damaging any other existing macros. There are two parts to these instructions: 

1. Editing the shared macros

2. Deleting any MathType macros that did not convert properly


Editing the shared macros

  1. Launch Word.
  2. Open up a document file. You should see an error message.
  3. Press OK to the error message.
  4. Press Ctrl-R or select Project Explorer from Visual Basic's View to display two smaller windows next to your macro code window which may already be visible. This step is here in case you might have closed the Project Explorer in the past as it will not show up on subsequent loads.
  5. Double-click AutoNew from Modules under the Normal list section of the project list in the upper left corner.
  6. Place an apostrophe in front of the following line:

WordBasic.Call "MTLoadPreferences.MAIN"

  1. Double-click AutoOpen from Modules under the Normal list section of the project list in the upper left corner.
  2. Place an apostrophe in front of the following line:

WordBasic.Call "MTLoadPreferences.MAIN"

  1. Choose Save Normal from the File menu.
  2. Choose Close and Return to Microsoft Word (ALT-Q) from the File menu.
  3. Press OK when you see: "This command will stop the debugger." to return to Word 97.

Deleting any MathType macros that did not convert properly

After you have edited the two macros above, you will need to delete the MathType macros that did not convert correctly. To do this:

  1. Choose Macros from the Macro submenu under Word's Tools menu to display the Macro Dialog.
  2. Press Organizer to display the Organizer dialog.
  3. Select each of the following macro names from the list under "In Normal.dot" and press the Delete button:

MTAuto
MTLoadPreferences
MTPreferences

  1. Once you have deleted the above three macros, press Close to return to your document in Microsoft Word. The error will no longer be generated.

Because we have removed the MathType preferences macros, the menu item "MathType Preferences" under your Tools menu will no longer work. You may find that you will be unable to remove the individual menu item. This is due to a problem in Word 97 in that any menu items that are imported from a earlier version of Word cannot be individually removed from the Word 97 menu bar. The only way that works successfully to remove the menu item is to Reset the menu bar. This removes the menu item but also all the MathType menu items along with any additional entries that you have made to the menu bar. We have made Microsoft aware of this problem.

Once you have completed the steps above, please proceed to Modifying MTUpdateEquations to accommodate Word 97.


If you have Word 97 and have not installed the MathType macros

The MathType macros that were written for Word 95 generally will work within Word 97 with two exceptions. The only Word 95 macros that will not function properly under Word 97 are the installation macro and the preference file attachment macro. Since the Word 95 installation macro does not work in Word 97, you will need to manually move the macros from the WW7MACRO.DOC file located in your MathType directory into your NORMAL.DOT template. The following instructions are broken up into two parts: 

1. Copying the macros from WW7MACRO.DOC into Word 97.

2. Creating menu items in Word 97.


Copying the macros from WW7MACRO.DOC into Word 97

  1. Launch Word 97, this will automatically launch a blank document based on the Normal template.
  2. Choose Close from Word's file menu.
  3. Choose Macros from the Macro submenu in Word's Tools menu to display the Macro dialog.
  4. Press Organizer to open the Macro Project Items tab on the Organizer dialog.
  5. Press Open File on the Organizer dialog to open the File Open dialog
  6. Change 'Files of type' from Document Templates *.dot to Word Documents *.doc.
  7. Change directories to your MathType directory. The default directory is C:\MathType.
  8. Select the WW7MACRO.DOC file and press Open. Word 97 will automatically convert the MathType WordBasic macros to Visual Basic for Applications. Once it is done you will see:

  1. For each of the following eight macros, select it from the list on the right and press Copy:

InsertEquation
MTEqnNum
MTEqnNumFormat
MTLib
MTMarkRef
MTPlaceRef
MTSecNum
MTUpdateEquations

  1. Once you have copied all the above macros to the NORMAL.DOT, press Close.

Creating menu items in Word 97

Once the macros have been copied over to NORMAL.DOT, you will want to create menu items that point to the macros for ease of use. The following will guide you through the process:

  1. Choose Customize from Word's Tools menu to open the Customize dialog.
  2. Click on the Commands tab.
  3. From the list of Categories on the left hand side of the dialog, select Macros to display the installed macros on the right hand side under Commands.
  4. Click and drag Normal.MTEqnNum.MAIN to the Insert menu; this will cause the menu list to drop and allow you to drop the macro reference in the menu at the bottom.
  5. Once you have dropped the menu item where you want it, a new menu item will appear with the name of the macro.
  6. Since most people won't equate Normal.MTEqnNum.MAIN to Equation Number, you may want to rename the menu item. Right click on the new menu item; this will produce a pop-up menu.
  7. In the pop-up menu you can change the Name of the menu item to something more descriptive such as "Equation Number".

Repeat steps 4-7 for the following macros:

MACRO NAME MENU
Normal.MTMarkRef.MAIN Equation Reference Insert
Normal.MTSecNum.MAIN Equation Section Insert
Normal.MTEqnNumFormat.MAIN Equation Number Format Tools
Normal.MTUpdateEquations.MAIN Update Equations Tools
  1. Once you are done creating menu items for the macros listed above, press Close.

Once you have completed the steps above, please proceed to Modifying MTUpdateEquations to accommodate Word 97.


Modifying MTUpdateEquations to accommodate Word 97

Many of MathType's users rely on the Update Equations macro to quickly update equation spacing, styles, and sizes within selections and whole documents under Word. Due to changes in the way that Word 97 deals with embedded objects, this macro must be modified in order to work properly.

Because Word 97 now deals with embedded objects in two different modes—float over text and in-line—the macro must specify the mode in which to insert the object. To make the necessary changes, do the following:

  1. Launch Word 97 to open a blank document based on the NORMAL.DOT template.
  2. Choose Close from the File menu of Word.
  3. Choose Macros from the Macro submenu in the Tools menu of Word to display the Macro dialog.
  4. Select MTUpdateEquations from the list of macros.
  5. Press Edit to open a Visual Basic editing window.
  6. At the top of the window containing the macro code, there will be two dropdown lists, the one of the left will display (General) and the one on the right will display MAIN; select RegenerateEquation from the list on the right.
  7. In RegenerateEquation, remove the following line:

WordBasic.EditPaste

  1. In place of the deleted code, type the following:

Selection.Delete
Selection.Range.PasteSpecial Placement:=wdInLine
WordBasic.CharRight 1

While you (the ":= syntax is correct according to the documentation provided by Microsoft, however, we have been receiving numerous calls from users saying that the ":" is causing the macro to fail. If you receive an error on the ":" is causing the macro to fail. If you receive an error later on the ":", delete it and save the macro.

  1. Locate the following line of code 14 lines below the point you just modified:

Char Right_

  1. Replace the line above with the following:

WordBasic.CharRight

  1. The end result should look something like this ("..." denotes continuation):

'====================================================================
' RegenerateEquation
'====================================================================
'returns 0 if regen'd OK; 1 if error
Private Function RegenerateEquation()
Dim RegenStat
Dim baseline
Dim Char
'regenerates a single OLE equation object, MathType equation
'picture, or Word formula field
RegenStat = RegenEquation 'attempts to regenerate equation
If RegenStat = 0 Then 'checks regeneration sucessful

Select Case UpdateTo
Case 0, 2 'MathType OLE1 Equation/TeX

Selection.Delete
Selection.Range.PasteSpecial Placement:=wdInLine
WordBasic.CharRight 1

Case 1
...
Case Else 'catch error/unexpected value

WordBasic.CharRight

End Select
...

  1. Choose Save Normal from the File menu.
  2. Choose Close from the File menu to return to Microsoft Word.

While you will be able to update equations to MathType (OLE 1) objects and to TeX, you will be unable to update equations to picture (non-OLE) objects. If you attempt to do so, Word 97 may generate the following error message: 

Microsoft Word Err=1051: This is not a valid measurement

This problem cannot be correct in the macros provided with MathType 3.1


Placing the "square root of alpha" button on your Word 97 toolbar

You will need to follow the following steps to place the "square root of alpha" toolbar button on Microsoft Word's toolbar. This procedure is now handled automatically with the newer version of the MathType macros. 

  1. Open a new or existing document.
  2. Select Customize from Word's Tools menu to open the Customize dialog.
  3. Click on the Commands tab.
  4. In the list of Categories, select Insert.
  5. In the list of Commands, locate the entry for "Equation Editor".
    Note: the list in not in alphabetical order. The entry for Equation Editor is toward the end of the list).
  6. Drag the button to one of your available toolbars and drop it there.
  7. Once you have placed the button, press Close on the Customize dialog.

Top of page

TechNotes Home   |   TechNote Wizard   |   Contact us

Copyright © 1996-2018 Design Science. All rights reserved.
Privacy statement
Follow MathType: