You are here:

DHTML/How to display Excel file inside Internet Explorer 6 ?

Advertisement


Question
Hi,

How to display Excel file inside Internet Explorer 6 ?

Thanks,
lzzzz

Answer
Unfortunately, I don't have a great answer for you.  I found this bit of code which "should" work if the server you're on houses the Excel software.  When I tried this code from my server using IE6, I got a message from IE telling me:

"Automation server can't create object"

That most likely means that my host doesn't have Excel on their server.  However, if your host does have Excel, it might work.  Try this script out--and don't forget to replace the name of your excel file in the function call (e.g., <a href="#" onclick="return startXL('Master Contact List.xls')">)

--

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>IE6 Excel Example</title>
<script type="text/javascript">
function startXL(strFile) {
  var myApp = new ActiveXObject("Excel.Application");
  if (myApp != null) {
     myApp.visible = true;
     myApp.workbooks.open(strFile);
  }
  return false
}
</script>
</head>
<body>
<a href="#" onclick="return startXL('Master Contact List.xls')">Pipeline Quality Report</a>
</body>
</html>  

DHTML

All Answers


Answers by Expert:


Ask Experts

Volunteer


Andrew Hoffman

Expertise

Ask me about JavaScript, CSS, HTML5/XHTML, or PHP. Chances are I'll be able to help you. I know the economy is in the tank, but if you like my answer, please consider donating a few bucks. It's like tipping your barista, if your barista served fresh code instead of coffee.

Experience

I started doing this when boy bands were still cool.

Education/Credentials
I read a lot of nerdy books to get here.

©2012 About.com, a part of The New York Times Company. All rights reserved.