Article ID: 158835 - View products that this article applies to.
This article was previously published under Q158835
This article has been archived. It is offered "as is" and will no longer be updated.
When you use the Get External Data command on the Data menu to return data from an external data source, the data that is returned is not correct. Some fields or rows that should contain data are blank; or some fields or rows contain incorrect data.
This problem may occur when Microsoft Excel uses the Microsoft Query dynamic data exchange (DDE) Fetch command to return the data to the worksheet. This problem occurs only under Windows 95. The problem does not occur when you use Microsoft Windows NT 3.51 or later.
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. The problem has been corrected in Microsoft Excel 97 for Windows.
For additional information on using DDE with Microsoft Query, please see the following articles in the Microsoft Knowledge Base:
149581You can use the following workarounds to avoid the problem described above.
(http://support.microsoft.com/kb/149581/EN-US/ )MSQuery: How to Retrieve Request Items Using DDERequest to MSQuery
(http://support.microsoft.com/kb/142357/EN-US/ )XL: Visual Basic Example Using BuildSQL
(http://support.microsoft.com/kb/105953/EN-US/ )MSQuery: Obtaining Login String from DDE Request to Query
Microsoft provides examples of Visual Basic for Applications procedures 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. The Visual Basic procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft support professionals can help explain the functionality of a particular macro, they will not modify these examples to provide added functionality, nor will they help you construct macros to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400.
The following methods describe macros that you can use to successfully return external data to your worksheet.
Method 1: Using Data Access Objects (DAO)You can use DAO in your macro to return the data to the worksheet. If you use this method, you must specify the path to the database, the Structured Query Language (SQL) statement for the query, and the destination cell for the data. The following macro example returns the data without any user interaction. To use this macro, use the following steps:
Method 2: Using DDE with Microsoft QueryYou can use DDE with Microsoft Query to return the data to the worksheet. When you use this method, you interactively select the data source, select the database, and create the query. To use this macro, use the following steps:
For more information about Data Access Objects, click the Index tab in Microsoft Excel Help, type the following text
data access, usingand then double-click the selected text to go to the "Using Data Access" topic.
Article ID: 158835 - Last Review: October 4, 2013 - Revision: 1.6