XL: OpenLinks Method Fails When Recorded Macro Is Run

Last reviewed: February 3, 1998
Article ID: Q134918
The information in this article applies to:
  • Microsoft Excel for Windows, versions 5.0, 5.0c
  • Microsoft Excel for the Macintosh, versions 5.0, 5.0a
  • Microsoft Excel for Windows NT, version 5.0
  • Microsoft Excel for Windows 95, versions 7.0, 7.0a

SYMPTOMS

In the versions of Microsoft Excel listed above, if you insert an OLE object and link to a file, and you then record the process of opening the source file, the resulting macro will not work. When you play back the Visual Basic for Applications macro, you receive the following error message:

   Run-time error '1004':
   OpenLinks method of Worksheet class failed

RESOLUTION

To create a link that you can update in a macro, do the following:

  1. Go to the source document in the source application.

  2. Select the information you want to bring to Microsoft Excel and click Copy on the Edit menu.

  3. Open the Microsoft Excel workbook in which you want this information to appear.

  4. Select the cell where you want this information to begin.

  5. Click Paste Special on the Edit menu.

  6. In the Paste Special Dialog box, click Paste Link, and then click Document Object.

  7. Click OK.

The object will appear.

If you then turn on the macro recorder and double-click the object to open the source document, the resulting macro will work.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Excel 97 for Windows and Microsoft Excel 98 Macintosh Edition.

For additional information, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q115693
   TITLE     : "Incorrect Argument Recorded with OpenLinks Method"

REFERENCES

For more information about the OpenLinks Method, choose the Search button in the Visual Basic Reference and type:

   OpenLinks Method


Additional query words: 5.00 5.00a 5.00c 7.00 7.00a Links OLE XL5 XL7
Keywords : kbprg PgmOthr
Version : WINDOWS:5.0,5.0a,5.0c,7.0; MACINTOSH:5.0
Platform : MACINTOSH WINDOWS
Issue type : kbbug
Solution Type : kbfix


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.

Last reviewed: February 3, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.