XL: OpenLinks Method Fails When Recorded Macro Is Run

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:

Q115693 "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.00a 5.00c 7.00a Links OLE XL5 XL7

Keywords : kbprg PgmOthr
Version : MACINTOSH:5.0,5.0a; WINDOWS:5.0,5.0c,7.0,7.0a; winnt:5.0
Platform : MACINTOSH WINDOWS winnt
Issue type : kbbug


Last Reviewed: October 22, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.