<html>
<head><title></title>
<script language="javascript"> 
 
var oExcel;   // abre excel 
var oExcelSheet;   // hoja Excel 
var oWkBooks; // libro de Excel    
 
function CopyExcel(){ 
    
      //Copia lo que se encuentra en la pagina actual 
        
   textRange = document.body.createTextRange(); 
   textRange.moveToElementText(listTable); 
   textRange.execCommand("Remove Format"); 
   textRange = document.body.createTextRange(); 
   textRange.execCommand("Copy"); 
   textRange = document.body.createTextRange(); 
    
    
        window.alert("La Página esta Siendo Copiada a Microsoft Excel (Presione YES en el Box Siguiente). Si No Se Copia, Cierre Excel y Vuelva a Intentarlo") 
    
           //Abre Microsoft Excel 
 
   oExcel = new ActiveXObject('Excel.Application'); 
   oWkBooks = oExcel.Workbooks.Add;    
   oExcelSheet = oWkBooks.Worksheets(1); 
   oExcelSheet.Application.Visible = true;  
 
oExcelSheet.Activate();  //Hace las activaciones de las Sheet en Microsoft Excel 
 
oExcel.ActiveSheet.Range('A1').Select; 
oExcel.ActiveSheet.PasteSpecial(0,false,false); 
 
 
   oExcel.ActiveSheet.Cells.EntireColumn.AutoFit; 
   oExcel.ActiveSheet.Range('A1').Select 
}            
</script> 
</head>
<html> 
<body> 
<input type=button value="Copiar a Excel" onclick="CopyExcel();"> 
 
<table id=listTable  border=1>
  <tr>
    <td>IDPIEZA</td><td>TIPO</td>
  </tr>
  <tr>
    <td>E11</td><td>Tuerca</td>
  </tr>
  <tr>
    <td>E201</td><td>Martillo</td>
  </tr>
  <tr>
    <td>E141</td><td>Alicate</td>
  </tr>
</table>