用javascript中使用vba的问题
xjbx
领域专家: 编程技术技术领域 2002-03-28 11:12:21 在javascript中内嵌有关的vba代码,实现word的“痕迹保留”,但是无法实现,代码如下:
<script language=javascript>
function OpenWord()
{
onerror=errormsg;
ExcelSheet = new ActiveXObject("Word.Application");
ExcelSheet.parent.UserName = '';
ExcelSheet.parent.UserInitials = '';
ExcelSheet.parent.UserAddress = "";
ExcelSheet.showgrammaticalerrors=true; ExcelSheet.showspellingerrors=true;
ExcelSheet.TrackRevisions = true;
ExcelSheet.PrintRevisions = true;
ExcelSheet.ShowRevisions = true;
ExcelSheet.Application.Visible = true;
var mydoc=ExcelSheet.Documents.Add("",0,1);
myRange =mydoc.Range(0,1)
if(myEditor.document.body.innerText=="")
{
myEditor.document.body.innerText=" "
}
var sel=myEditor.document.body.createTextRange()
sel.select()
myEditor.document.execCommand('Copy')
sel.moveEnd('character')
myRange.Paste();
ExcelSheet.ActiveWindow.ActivePane.View.Type=3
wordflag=1
}
.....
<script>
其中实现“痕迹保留”的一段:
ExcelSheet.showgrammaticalerrors=true;
ExcelSheet.showspellingerrors=true;
ExcelSheet.TrackRevisions = true;
ExcelSheet.PrintRevisions = true;
ExcelSheet.ShowRevisions = true;
无法通过。
请高手指点,问题是出在那?谢谢