Run old macros in Excel 97


Q I have some Excel macros written for Excel 4. To enable the dot matrix printer to print faster I used the command "=LINE.PRINT(5)". It worked great until I updated to Windows 95. Now the program can't find the printer, and Excel gives a general protection fault and crashes. Any idea what's going on?

û R Bishop

AMicrosoft has standardised on Visual Basic for the macros in all its applications. Excel 5 for Windows 3.1 introduced Visual Basic macros for Excel. This version of Excel also supported the old Excel macro language that was used by Excel 4. However, more recent versions of Excel do not provide direct support for the old macro language. This means that your Excel 4 macros cannot be used with Excel 95 or Excel 97.

Converting your Excel 4 macro to Visual Basic is complicated by the fact that there is no exact Visual Basic equivalent to the =LINE.PRINT() macro. However, you can execute Excel 4 macro commands in a Visual Basic macro by using the statement ExecuteExcel4Macro ("[Excel 4 Macro Command]").

The full macro would look like this:

Sub Example()

ExecuteExcel4Macro ("LINE.PRINT(5)")

End Sub

For a complete list a Visual Basic equivalents for Excel 4 macro functions and commands download macrofun.exe from www.microsoft.com or from our cover CD.

û Roy Chambers


Category:spreadsheet
Issue: October 1998

These Web pages are produced by Australian PC World © 1998 IDG Communications