Microsoft KB Archive/178982

From BetaArchive Wiki
Knowledge Base


XL98: Run-Time Error 57121 If Macro Uses ControlFormat Object

Article ID: 178982

Article Last Modified on 9/11/2002



APPLIES TO

  • Microsoft Excel 98 for Macintosh



This article was previously published under Q178982

SYMPTOMS

In Microsoft Excel 98 Macintosh Edition, if you run a Microsoft Visual Basic for Applications macro or procedure that attempts to set the properties of a control in a worksheet, you may receive either of the following error messages:

Run-time error '57121':
Can't exit design mode because Control '<Control>' can not be created.

Run-time error '32809':
Application-defined or object-defined error

CAUSE

This problem occurs because ActiveX controls are not supported in Microsoft Excel 98 Macintosh Edition. For additional information, please see the following article in the Microsoft Knowledge Base:

274222 MacXL: Error When You Paste ActiveX Controls or Run a Macro


MORE INFORMATION

The following line of code will not work in either Microsoft Excel 98 Macintosh Edition or Microsoft Excel 97 for Windows:

   ActiveSheet.Shapes("ListBox1").ControlFormat.ListFillRange = _
 
       "$A$1:$A$10"
                

In Microsoft Excel 98 Macintosh Edition, the code fails because ActiveX controls are not supported. In Microsoft Excel 97 for Windows, the code fails because the ControlFormat object does not apply to ActiveX controls. For more information about this issue in Microsoft Excel 97, please see the following article in the Microsoft Knowledge Base:

171075 XL97: Run-Time Error 438 If Macro Uses ControlFormat Object


If ListBox1 is a Microsoft Excel list box, as opposed to an ActiveX list box, and if the workbook does not contain any ActiveX controls, the code works correctly.


Additional query words: XL98 ocx active x

Keywords: kbprb kbdocerr KB178982