2013-01-24 12 views
2

如果我使用VB腳本 - 如果我到C的iexplore.exe運行:我該如何操作瀏覽器窗口進一步

Set ie = CreateObject("InternetExplorer.Application") 

要打開一個URL,我可以使用下面的

ie.Navigate "http://google.com" 

但我不能去這個選項,因爲「InternetExplorer.Application」打開64位IE瀏覽器。我需要32位IE瀏覽器才能工作。所以我用以下

set Objshell=CreateObject("WScript.shell") 
return=Objshell.run ("""C:\Program Files\Internet Explorer\iexplore.exe""" & "www.google.com") 

因此,在這種情況下,我不知道如何瀏覽或使用getElements()爲打開瀏覽器窗口。

請讓我知道如何處理這個!

回答

1
Option Explicit 

Main() 

Sub Main() 
    Force32bit() 
    Dim objExplorer : Set objExplorer = CreateObject("InternetExplorer.Application") 
    Dim i 

i = true 
do while i = true 
    objExplorer.Navigate "www.google.com" 
    objExplorer.ToolBar = 1 
    objExplorer.StatusBar = 1 
    objExplorer.Width = 800 
    objExplorer.Height = 800 
    objExplorer.Left = 1 
    objExplorer.Top = 1 
    objExplorer.Visible = 1 
    WScript.Sleep 6000 
    objExplorer.Navigate "www.yahoo.com" 
wscript.sleep 6000 
loop 

End Sub 

Sub Force32bit() 
    If InStr(UCase(WScript.FullName), "SYSTEM32") > 0 and CreateObject("Scripting.FileSystemObject").FolderExists("C:\Windows\SysWOW64") Then 
     Dim objShell : Set objShell = CreateObject("WScript.Shell") 
     objShell.CurrentDirectory = "C:\Windows\SysWOW64" 
     objShell.Run "wscript.exe " & Chr(34) & WScript.ScriptFullName & Chr(34), 1, False 
    End If 
End Sub 

如果你回到你原來的代碼,只需修改實例線以下查找解決here

+0

嗨,感謝您的支持。 – user1697487

+0

如果我使用Objshell = CreateObject(「WScript.shell」) return = Objshell.run(「」「C:\ Program Files \ Internet Explorer \ iexplore.exe」「」「&」www.google.com「)如何可以我處理它? – user1697487

0
Dim Shell 
Set Shell = CreateObject("WScript.Shell") 
Shell.Run "iexplore.exe www.google.com" 
+0

你可以給你的答案添加一些解釋嗎? –

0

Set ie = CreateObject("InternetExplorer.Application.1") 

這應該是足夠給力IE應用程序對象的32位實例。

如果您仍想使用shell路徑,請記住您要從程序(x86)文件夾啓動iEXPLORE.EXE。

"C:\Program Files (x86)\Internet Explorer\iexplore.exe" 
相關問題