XL97: ScreenUpdating Causes Problems in MS Internet Explorer

ID: Q160600

The information in this article applies to:

SYMPTOMS

When you view a Microsoft Excel worksheet in Microsoft Internet Explorer, version 3.0 or 3.01, and run a Visual Basic for Applications macro, Microsoft Excel may not redraw the worksheet correctly after the macro is finished running. When this behavior occurs, cells and objects in the worksheet may not appear to be updated by the macro.

CAUSE

This problem may occur when you run a macro that turns off screen updating with the following line of code:

   Application.ScreenUpdating = False

The problem will occur even if your macro also includes the following line of code:

   Application.ScreenUpdating = True

WORKAROUND

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/support/supportnet/refguide/

To work around this behavior, use either of the following methods.

Method 1

You can force the worksheet to be redrawn correctly by resizing the Microsoft Internet Explorer window in any way. For example, resize the window by doing any of the following:

Method 2

If the macro includes the following line of code:

   Application.ScreenUpdating = True

you can force the worksheet to redraw correctly programmatically by displaying a different section of the worksheet and returning to the cell range you originally selected. When you do this, you force the screen to be redrawn, which prevents the problem from occurring. To do this, add the following lines of code to the end of the macro immediately before the "End Sub" line:

   Set xRange = Selection    'Set a variable to the active selection.
   Range("IV65536").Select   'Select another cell in the sheet.
   xRange.Select             'Select the original range.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

MORE INFORMATION

In Microsoft Excel, you can disable screen updating while running a macro by adding the following line of code:

   Application.ScreenUpdating = False

Screen updating remains disabled until the macro finishes running or you re- enable updating by setting the ScreenUpdating property to True.

If you run a macro that sets ScreenUpdating to False while you view a worksheet in Microsoft Internet Explorer, ScreenUpdating is not correctly re-enabled when the macro is finished running.

Additional query words: 97 XL97

Keywords          : kbdta kbdtacode xlui KbVBA xlweb 
Version           : WINDOWS:97
Platform          : WINDOWS
Issue type        : kbprb

Last Reviewed: May 18, 1999