This article was previously published under Q197922
This article has been archived. It is offered "as is" and will no longer be updated.
There may be times when you want to use links or Microsoft JScript in a Web page tooffer quick access to different parts of an Excel Document. For example,you might offer departmental statistics on an intranet site that linkseasily to charts or previous months' reports in the same document.
You can open an Excel 97 file to a named area, or any sheet and cell from aanchor link or script in an HTML page as long as the HTML page is accessedvia http ( not by double-clicking it in Windows Explorer, nor usingfile://) and Excel is opened within the browser. If Excel is opened outsideof the browser, it will not move to the specified link.
The syntax is based on standard Excel syntax. You can use this method in aframe declaration, an anchor tag, or even in script when usinglocation.href.
This HTML demonstrates how the links and Jscript look:
<HTML><HEAD><Title>Excel Linking Example</Title></HEAD><body><p><a href="http://localhost/excel/asheet.xls#Sheet2!D4">This link will open the Excel file to the second page with the focus oncell D4</a>.<a href="http://localhost/excel/asheet.xls#TableName">This link will set the focus on a named area of the spreadsheet</a>.</p><form><input type=button value="Via Jscript" onclick='location.href = "asheet.xls#TableName"'></form></body></html>
Make sure you create an Excel file with a named cell, and change the HTMLabove to reflect the name of your Excel file, and the named area.
The names linked to are not case-sensitive.
If the link is specified with a file:// type URL, there will be an error.In this circumstance, the whole link is treated like the file name.
A fully qualified URL is not necessary; that is, you can usehref="linkpage2.xls#TableName" as long as the browser, or frameset wasloaded using http:// rather than file://.
In a frameset scenario, you can link to different parts of the Excel file,from the other frame, without causing a reload. This is interesting becausenormal security does not allow you to directly access the Excel object inthe browser.
Although you can link to an Excel 95 file, you cannot navigate through itin this method.
When you reference a sheet name that includes a space, you must enclose the sheet name in single quotation marks (for example, <a href="/?scid=asheet.xls%23%27sheet%20two%27%21d4">). If you do not do this, you may receive the following error message when you click the hyperlink in the Web page:
Reference is not valid
For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
Microsoft Internet Explorer 3.0, Microsoft Internet Explorer 3.01, Microsoft Internet Explorer 3.02, Microsoft Internet Explorer 4.0 128-Bit Edition, Microsoft Internet Explorer 4.01 Service Pack 2, Microsoft Internet Explorer 4.01 Service Pack 1, Microsoft Internet Explorer 4.01 Service Pack 2, Microsoft Internet Explorer (Programming) 5_beta, Microsoft Excel 97 Standard Edition