The information in this article applies to:
SYMPTOMSIn Microsoft Excel, when you use the SQLRetrieve function in a Microsoft Visual Basic for Applications procedure to return data from an ODBC data source to a Microsoft Excel worksheet, you may receive the following error message twice and no data will be retrieved: This error only occurs when you use Microsoft Excel for Windows, version 5.0. For all other versions of Microsoft Excel listed at the beginning of this article, the SQLRetrieve function returns an Error 2015, which indicates that the function was unable to paste the data to the worksheet. Also, no data is returned to the worksheet. CAUSE
The error message stated above occurs in Microsoft Excel version 5.0,
only when the destination worksheet has been protected and any or all
cells in the destination range have been locked.
WORKAROUNDMicrosoft 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/overview/overview.aspTo avoid this problem, unprotect the worksheet before you use the SQLRetrieve function. The following macro example shows how to unprotect a worksheet, retrieve the data, and then protect the sheet again. Visual Basic Macro Code Example
STATUSMicrosoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. REFERENCESFor more information on SQLRetrieve, click the Search button in Microsoft Excel Visual Basic Help and type: SQLRetrieveFor more information on protecting and unprotecting a worksheet, click the Search button in Microsoft Excel Visual Basic Help and type: Protect -or- Unprotect Additional query words: 5.00a 5.00c 7.00a 8.00 97 sheet protection book workbook
Keywords : kbprg kbdta kbdtacode PgmOthr KbVBA |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |