reusing Internet Explorer COM Automation Object

前端 未结 1 1117
名媛妹妹
名媛妹妹 2020-12-03 23:02

I am using VBScript macros to utilize the InternetExplorer.Application COM automation object and I am struggling with reusing an existing instance of this object.

Fr

相关标签:
1条回答
  • 2020-12-03 23:57

    Try This:

    
    Set IEObject =  GetObject( ,"InternetExplorer.Application" )
    

    *Notice the comma before "InternetExplorer.Application"

    EDIT: Try this:

    
    Dim IE As SHDocVw.InternetExplorer
    
    Set IE = GetObject(,"InternetExplorer.Application")
    

    You can also try this:

    
    Dim ShellApp
    Set ShellApp = CreateObject("Shell.Application")
    Dim ShellWindows
    Set ShellWindows = ShellApp.Windows()
    Dim i
    For i = 0 To ShellWindows.Count - 1
        If InStr(ShellWindows.Item(i).FullName, "iexplore.exe") <> 0 Then
            Set IEObject = ShellWindows.Item(i) 
        End If
    Next
    IEObject.Navigate2("http://www.google.com")
    

    EDIT:
    What you are trying may not be possible, take a look at this. http://support.microsoft.com/kb/239470

    0 讨论(0)
提交回复
热议问题