Dim aa
aa = 11
Set oIE = WScript.CreateObject("InternetExplorer.Application","Event_")
With oIE   
  .MenuBar = 0 '不显示IE对象菜单栏
  .StatusBar = 0 '不显示IE对象状态栏  
  .AddressBar = 0 '不显示IE对象地址栏
  .ToolBar = 0 '不显示IE对象工具栏  
  .Height = 150 '设置IE对象高度  
  '.FullScreen=0 '全屏化IE对象  
  .Width = 281 '设置IE对象宽度
  .Navigate "about:blank" '设置IE对象默认指向的页面  
  .Visible = 1 '设置是否可见  
  .Resizable = 0 '设置IE对象大小是否可以被改动  
  .Document.Write "<HTML><title>修改管理</title><BODY scroll='no'>编号:<input id='input1' input1 value="&aa&"
  .Document.Write "<center><input type=BUTTON name=certain value=确定>"
  End With
'&#160;
Set oIE.Document.getElementById("certain").OnClick = GetRef("aaa")Do
  WScript.Sleep 200
LoopSub aaa
  Dim str
  str = oIE.Document.getElementById("input1").Value & VbCrLf
  str = str & oIE.Document.getElementById("input2").Value & VbCrLf
  str = str & oIE.Document.getElementById("input3").Value
  WScript.Echo str
End Sub
Sub Event_OnQuit
  WScript.Quit
End Sub如上代码在VBSEdit中功能够正常运行,但是被其他方法调用时确报错:
报错信息为 缺少对象:'WScript'
修改为如下后,继续报错
Set WshShell = CreateObject("WScript.Shell")  
Set oIE = WshShell.CreateObject("InternetExplorer.Application","Event_")
继续报错为:对象不支持此属性或方法:"WshShell.CreateObject"
麻烦大虾帮忙解决下,谢谢!

解决方案 »

  1.   

    WScript.exe或者CScript.exe运行的vbs脚本可以使用WScript.CreateObject来接收事件;
    网页中不支持使用WScript.CreateObject来接收事件,因为IE在运行时没有提供WScript对象;
    如果是ASP的话可以在服务器端用Server.CreateObject来接收事件.
      

  2.   

    在VBSEdit中功能够正常运行,并得到预设的网页页面结果
      

  3.   


    在VBSEdit中没有出错,但是被别的调用时就报错
    报错信息为: 缺少对象:'WScript'
    我按照提示修改了代码Set WshShell = WScript.CreateObject("WScript.Shell")   
    Set oIE = WshShell.CreateObject("InternetExplorer.Application","Event_")\继续 报错提示:对象不支持此属性或方法:"WshShell.CreateObject"
      

  4.   


    刚才打多了符号
    以下为准:在VBSEdit中没有出错,但是被别的调用时就报错
    报错信息为: 缺少对象:'WScript'
    我按照提示修改了代码Set WshShell = WScript.CreateObject("WScript.Shell")   
    Set oIE = WshShell.CreateObject("InternetExplorer.Application","Event_")继续 报错提示:对象不支持此属性或方法:"WshShell.CreateObject"