以下代码,发布网站后正确,但在IDE中开始执行却显示"Automation 服务器不能创建对象"
开发工具是Visual Studio 2005
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %><!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 runat="server">
    <title>无标题页</title>
<Script Language="JavaScript"> 
function Validator() 

var wApp = new ActiveXObject("Word.Application.11");       
        
wApp.Visible = true ;        
wApp.Documents.Open( "HTTP://200.100.3.56/test/qq.doc" );
     wApp.ActiveDocument.TrackRevisions = true ;
     wApp.ActiveDocument.ShowRevisions = true  ;
 wApp.ActiveDocument.Application.UserName= "qiaoqun";         } 
</script> </head>
<body>
         &nbsp;<input type="button" name="word" value="word" onclick="Validator()">
</body>
</html>

解决方案 »

  1.   

    不同浏览器的问题啊.
    创建XMLHTTPREQUEST对像的方法要不一样的.
    比如:
    var aj = new Object();
    aj.statusId = statusId ? document.getElementById(statusId) : null;
    aj.targetUrl = '';
    aj.sendString = '';
    aj.recvType = recvType ? recvType : 'XML';
    aj.resultHandle = null; aj.createXMLHttpRequest = function() {
    var request = false;
    if(window.XMLHttpRequest) {
    request = new XMLHttpRequest();
    if(request.overrideMimeType) {
    request.overrideMimeType('text/xml');
    }
    } else if(window.ActiveXObject) {
    var versions = ['Microsoft.XMLHTTP', 'MSXML.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.7.0', 'Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.5.0', 'Msxml2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP'];
    for(var i=0; i<versions.length; i++) {
    try {
    request = new ActiveXObject(versions[i]);
    if(request) {
    return request;
    }
    } catch(e) {
    //alert(e.message);
    }
    }
    }
    return request;
    } aj.XMLHttpRequest = aj.createXMLHttpRequest();
      

  2.   

    以为是AJAX的呢,
    你把var   wApp   =   new   ActiveXObject("Word.Application.11");  改成var   wApp   =   new   ActiveXObject("Word.Application");  试试.
      

  3.   

    谢谢了,去掉".11"后,一样的,看了都是一个CLSID,WORD 2003,现在情况是在IIS中做虚拟目录,直接浏览不行,但在ie中输入200.100.3.56/test(地址)则行,在VISUAL STUDIO 2005中也不行,怪透了,不怎么办
      

  4.   

    还有就是,"Word.Application"换成"SharePoint.OpenDocument"就都对了,但我要保留改动痕迹,不能用这个,其功能不到位