InternetExplorer.Application有时仅支持Document.Title

时间:2017-04-27 18:29:08

标签: internet-explorer vbscript

此代码只是打开IE浏览器,读取您所在的页面,当您导航到页面copal输入时,然后导航到页面数据服务,它将按两次并刷新页面。我从桌面上运行得很好,但现在当我从快捷方式运行它时,有时会出现错误,其中一行IE.Documents.Title"对象不支持此属性或。方法"

我是从VBS文件运行的,但我也使用Excel VBA运行代码。

Set objExplorer = WScript.CreateObject("InternetExplorer.Application", "IE_")
Set objExplorer = WScript.CreateObject("InternetExplorer.Application", "IE_")

Set IE = CreateObject("InternetExplorer.Application")

IE.Navigate "WEBSITE"
IE.Visible = True
WScript.Sleep 2000
'On Error Resume Next
While IE.ReadyState <> 5 'I use 5 because I am pretty sure it doesn't exist.
  'DoEvents

  If Err.Number <> 0 Then WScript.Quit
    'WScript.Sleep 20

    If IE.LocationURL = "PAGE ON WEBSITE" Then
      IE.Goback
      IE.Goback
      IE.Refresh

      'Application.Wait (Now + TimeValue("00:00:03"))
    End If

    If IE.Document.Title = "Copal Inputs" Then
      'This is sometimes supported, but sometimes not
      x = IE.Document.Title

      Cis = 1
      'MsgBox "DS"
    End If
    If IE.Document.Title = "Data Services" Then
      'This is sometimes supported then sometimes not
      If Cis = 1 Then
        IE.Goback
        IE.Goback

0 个答案:

没有答案
相关问题