XL97: ScreenUpdating Causes Problems in MS Internet Explorer (160600)



The information in this article applies to:

  • Microsoft Internet Explorer 3.01 for Windows 95
  • Microsoft Internet Explorer 3.0 for Windows 95
  • Microsoft Excel 97 for Windows

This article was previously published under Q160600

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 a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site: For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site: 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:

  • Minimize, and then restore the window
  • Maximize, and then restore the window
  • Resize the window manually

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.

Modification Type:MinorLast Reviewed:10/10/2006
Keywords:kbdtacode kbprb KB160600