XL97: VBA Macro Behavior Is Different from MS Excel 5.0 or 7.0

Last reviewed: March 13, 1998
Article ID: Q162721
The information in this article applies to:
  • Microsoft Excel 97 for Windows

When you run a Visual Basic for Applications macro in Microsoft Excel 97, the way the macro behaves may be different from the way it behaves in earlier versions of Microsoft Excel. This may be true for any of the following reasons:

  • The architecture of Microsoft Excel 97 is somewhat different from the architecture that is used in earlier versions of Microsoft Excel. Some elements (for example, menu bars and toolbars) are greatly enhanced in Microsoft Excel 97. As a result, Visual Basic code that interacts with these elements may work differently.
  • Microsoft Excel 97 corrects some problems that are present in earlier versions of Microsoft Excel. As a result, Visual Basic code that works in earlier versions of Microsoft Excel may work differently in Microsoft Excel 97.
  • Because all of the Microsoft Office programs include Microsoft Visual Basic for Applications, the Visual Basic environment in Microsoft Excel includes changes that accommodate the new programs and provide consistent behavior in all programs. As a result, code that uses OLE Automation or other cross-product functionality may work differently in Microsoft Excel 97.

Microsoft realizes the importance of minimizing the amount of effort that is required to use macros in Microsoft Excel 97. Microsoft Excel 97 is designed to be compatible with earlier versions of Microsoft Excel; however, in some cases, it may be necessary to modify your code so that it works in Microsoft Excel 97.

Modifying your code so that it works with Microsoft Excel 97 usually requires making only a few minor changes. The following is a list of articles in the Microsoft Knowledge Base that address compatibility issues in Microsoft Excel 97. Wherever possible, the articles contain the information you need to modify Visual Basic macros so that they function in both Microsoft Excel 97 and in earlier versions of Microsoft Excel.

   ARTICLE-ID: Q143452
   TITLE     : XL97: MS Excel Hangs When You Programmatically Save a
               Workbook

   ARTICLE-ID: Q143453
   TITLE     : XL: Named Arguments Are Not Supported with DAO

   ARTICLE-ID: Q143458
   TITLE     : XL97: Cannot Move or Copy Sheet After Last Sheet

   ARTICLE-ID: Q143460
   TITLE     : XL97: Overflow Error Occurs When Using Err Object

   ARTICLE-ID: Q143461
   TITLE     : XL97: CreateObject and GetObject Work Differently

   ARTICLE-ID: Q154873
   TITLE     : XL: Error When You Concatenate String and Numeric Values

   ARTICLE-ID: Q156879
   TITLE     : XL97: Visual Basic Modules Cannot Be Hidden or Protected

   ARTICLE-ID: Q156880
   TITLE     : XL97: Using the MenuBars Method in Microsoft Excel 97

   ARTICLE-ID: Q157027
   TITLE     : XL97: Attached Toolbar Is Not Saved in 5.0/95 File Format

   ARTICLE-ID: Q157103
   TITLE     : XL97: Macro Stops Running When its Workbook is Closed

   ARTICLE-ID: Q157107
   TITLE     : XL97: "Type Mismatch" Comparing String Variable to
               Boolean

   ARTICLE-ID: Q157108
   TITLE     : XL97: Options not Available in Macro Options Dialog Box

   ARTICLE-ID: Q157113
   TITLE     : XL97: "Invalid Use of Null" Error Setting OnRepeat Method

   ARTICLE-ID: Q157124
   TITLE     : XL97: Styles("X").Parent Different in MS Excel 97

   ARTICLE-ID: Q157203
   TITLE     : XL97: Cannot Add Macros to the Tools Menu

   ARTICLE-ID: Q157308
   TITLE     : XL97: Calling RunAutoMacros Method More than Once Fails

   ARTICLE-ID: Q157351
   TITLE     : XL97: Compile Error Passing ParamArray

   ARTICLE-ID: Q157412
   TITLE     : XL97: Select Method May Select More Cells Than Expected

   ARTICLE-ID: Q157436
   TITLE     : DAO 3.0 CopyFromRecordSet Method Not Compatible With XL97

   ARTICLE-ID: Q157471
   TITLE     : XL97: Run-Time Error Using CreateObject With DAO.DBEngine

   ARTICLE-ID: Q157553
   TITLE     : XL97: Dialog Boxes and UserForms Use Tahoma Font

   ARTICLE-ID: Q157754
   TITLE     : XL97: Problems When Disabling/Enabling Menus in MS Excel
               97

   ARTICLE-ID: Q157755
   TITLE     : XL97: Using "Checked", "Gray", and "Unchecked" in Macros

   ARTICLE-ID: Q158066
   TITLE     : XL97: Reference to DAO 3.0 Changes to DAO 3.5 When File
               Opened

   ARTICLE-ID: Q158072
   TITLE     : XL97: Menu Added in Wrong Position on Menu Bar

   ARTICLE-ID: Q158080
   TITLE     : XL97: Cannot Paste Array Formula in its Original Cell

   ARTICLE-ID: Q158222
   TITLE     : XL97: ParamArrays are Always Zero-Based

   ARTICLE-ID: Q158353
   TITLE     : XL97: Error When Invalid Characters in Drawing Object
               Name

   ARTICLE-ID: Q158355
   TITLE     : XL97: ParamArray Must be Declared as an Array of Variant

   ARTICLE-ID: Q158360
   TITLE     : XL97: PasteSpecial Method Activates Target Sheet

   ARTICLE-ID: Q158434
   TITLE     : XL97: Cannot Make Changes to Some Shortcut Menus

   ARTICLE-ID: Q158472
   TITLE     : XL97: No Automatic Type Coercion Between Variable Types

   ARTICLE-ID: Q158550
   TITLE     : XL97: Problems Disabling and Enabling Shortcut Menus

   ARTICLE-ID: Q158632
   TITLE     : XL97: Limitations for Naming Visual Basic Modules

   ARTICLE-ID: Q158638
   TITLE     : XL97: ApplyNames Method May Cause Invalid Page Fault

   ARTICLE-ID: Q158711
   TITLE     : XL97: Cannot Edit Text Box with Unlocked Text

   ARTICLE-ID: Q158746
   TITLE     : XL97: Error When Passing an Array Value Between Macros

   ARTICLE-ID: Q158801
   TITLE     : XL97: Text is Truncated in a Text Box with Rounded
               Corners

   ARTICLE-ID: Q158895
   TITLE     : XL97: Invalid Page Fault After Closing Last Open Workbook

   ARTICLE-ID: Q158905
   TITLE     : XL97: "Bad DLL Calling Convention" When Running a Macro

   ARTICLE-ID: Q158997
   TITLE     : XL97: Error When Variable Refers to Deleted or Moved
               Sheet

   ARTICLE-ID: Q159465
   TITLE     : XL97: "Module not Found" Error Opening Workbook

   ARTICLE-ID: Q159622
   TITLE     : XL97: Cannot Change Value for Form Control on Worksheet

   ARTICLE-ID: Q159794
   TITLE     : XL97: Cannot Programmatically Close Referenced Workbook

   ARTICLE-ID: Q159845
   TITLE     : XL97: Parentheses Around Object May Dereference the
               Object

   ARTICLE-ID: Q159861
   TITLE     : XL97: Setting Window Caption Changes Caption for Active
               Window

   ARTICLE-ID: Q159877
   TITLE     : XL97: Crash Saving Workbook If Module Name Contains Equal
               Sign

   ARTICLE-ID: Q159914
   TITLE     : XL97: Bitmap Image Shrinks When Pasted to Toolbar Button

   ARTICLE-ID: Q159915
   TITLE     : XL97: Deleting Cells While In a For Each Loop

   ARTICLE-ID: Q159922
   TITLE     : XL97: Using Quit Method May Cause Illegal Operation

   ARTICLE-ID: Q159938
   TITLE     : XL97: Structure and Windows Arguments of Protect Method

   ARTICLE-ID: Q159944
   TITLE     : XL97: Range.PasteSpecial Changes Selection

   ARTICLE-ID: Q159947
   TITLE     : XL97: Illegal Operation Unhiding a Row with a Macro

   ARTICLE-ID: Q159949
   TITLE     : XL97: Input # Statement Does Not Retain Trailing Spaces

   ARTICLE-ID: Q159957
   TITLE     : XL97: Run-time Error '1004' Accessing Locally Defined
               Name

   ARTICLE-ID: Q159958
   TITLE     : XL97: Unexpected Results Paste Linking Noncontiguous
               Range

   ARTICLE-ID: Q159960
   TITLE     : XL: Drawing Objects Behave Differently when Clicked

   ARTICLE-ID: Q159964
   TITLE     : XL97: Pointer is an Hourglass When You Display a
               Message Box

   ARTICLE-ID: Q159966
   TITLE     : XL97: Redraw Problem Changing Visibility of Object on
               Dialog

   ARTICLE-ID: Q160032
   TITLE     : XL97: Invalid Page Fault Saving a Workbook or Add-In

   ARTICLE-ID: Q160058
   TITLE     : XL97: Error Changing Order of Option Buttons on a
               Dialog Sheet

   ARTICLE-ID: Q160085
   TITLE     : XL97: Page Fault Accessing Demand-Loaded Add-in

   ARTICLE-ID: Q160462
   TITLE     : XL97: Auto_Close Macros Run When you use Application.Quit

   ARTICLE-ID: Q160520
   TITLE     : XL97: Error Adding or Deleting a Menu Command in a Macro

   ARTICLE-ID: Q163718
   TITLE     : XL97: Page Setup Command Does Not Exist in Modules

   ARTICLE-ID: Q164500
   TITLE     : XL97: Help Argument for MsgBox Function Behaves
               Differently

   ARTICLE-ID: Q164810
   TITLE     : XL97: Run-Time Error Using ShowDependents Method

   ARTICLE-ID: Q165103
   TITLE     : XL97: Value Returned by VarType for Omitted Arguments
               Differs

   ARTICLE-ID: Q165866
   TITLE     : XL97: How to Use File DSNs and DSN-less Connections

   ARTICLE-ID: Q166101
   TITLE     : XL97: Visible Property does not Apply to All CommandBars

   ARTICLE-ID: Q167178
   TITLE     : XL97: Some Properties and Methods Are Missing in Object
               Browser

   ARTICLE-ID: Q168364
   TITLE     : XL97: Charts.Delete Command in Macro May Delete Worksheets

   ARTICLE-ID: Q168436
   TITLE     : XL97: Can't Tile Windows with Macro If a Window Is
               Minimized

   ARTICLE-ID: Q168754
   TITLE     : XL97: Error Applying Comment When Worksheets Are Grouped


Additional query words: 97 XL97 macro subroutine code fail error halt
message convert conversion vba xl97vbmigrate
Keywords : kbprg kbprb kbfaq
Version : WINDOWS:97
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 13, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.