OpenLinks Method Fails When Recorded Macro Is Run (134918)
The information in this article applies to:
- Microsoft Excel for Windows 95 7.0a
- Microsoft Excel for Windows 5.0c
- Microsoft Excel for Windows NT 5.0
- Microsoft Excel for the Macintosh 5.0a
This article was previously published under Q134918 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:
- Go to the source document in the source application.
- Select the information you want to bring to Microsoft Excel and
click Copy on the Edit menu.
- Open the Microsoft Excel workbook in which you want this
information to appear.
- Select the cell where you want this information to begin.
- Click Paste Special on the Edit menu.
- In the Paste Special Dialog box, click Paste Link, and then click
Document Object.
- 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:
115693 "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:
Modification Type: | Minor | Last Reviewed: | 10/11/2006 |
---|
Keywords: | kbbug kbfix kbProgramming KB134918 |
---|
|