DOCUMENT:Q191205 11-AUG-1998 [vbwin] TITLE :BUG: Run-Time Error 458 When Late-Binding Rich TextBox Control PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:5.0,6.0 OPER/SYS:WINDOWS KEYWORDS:kbCtrl kbVBp600bug kbVBp500bug kbcode kberrmsg ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, versions 5.0, 6.0 --------------------------------------------------------------------- SYMPTOMS ======== When you access the BackColor property of a Rich TextBox Control that is late-bound, the following error occurs when you run the program: Error 458: Variable uses an Automation type not supported in Visual Basic. RESOLUTION ========== Instead of late-binding the control, try to early-bind it. For example, you can replace the following code: Dim ctl As Control Set ctl = RichTextBox1 with: Dim ctl As RichTextBox Set ctl = RichTextBox1 STATUS ====== Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATION ================ Steps to Reproduce Behavior --------------------------- 1. Create a new Standard EXE project in Visual Basic. Form1 is created by default. 2. Select Components from the Project menu, browse for the Microsoft Rich TextBox Control 6.0, and select it. Add the control to Form1. 3. Paste the following code into the code window of Form1: Private Sub Form_Load() Dim ctl As Control Set ctl = RichTextBox1 ctl.BackColor = vbRed If ctl.BackColor <> vbRed Then MsgBox "fail" End If End Sub 4. Press F5 to run the project. RESULTS: The following error appears: Error 458: Variable uses an Automation type not supported in Visual Basic Additional query words: ====================================================================== Keywords : kbCtrl kbVBp600bug kbVBp500bug kbcode kberrmsg Version : WINDOWS:5.0,6.0 Platform : WINDOWS Issue type : kbbug Solution Type : kbpending ============================================================================= 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. Copyright Microsoft Corporation 1998.