使用Excel VBA打开并浏览IE

我正在运行64位的Excel,我需要打开32位的IE浏览器,以便在我正在浏览的页面上运行java(我正在做这个工作有一些特定的限制)。 我不能为了我的生活找出如何去工作。

我已经尝试了所有我发现search的代码,但似乎没有为我工作。 当我运行下面的代码时,我得到一个错误

activex组件不能创build对象“错误在这里:Set objShellWindows = objShell.Windows

AppURL = "http://www.stackoverflow.com" AppToRun = "iexplore -nomerge" AboutBlankTitle = "Blank Page" LoadingMessage = "Loading stackoverflow..." ErrorMessage = "An error occurred while loading stackoverflow. Please close the Internet Explorer with Blank Page and try again. If the problem continues please contact IT." EmptyTitle = "" 'Launch Internet Explorer in a separate process as a minimized window so we don't see the toolbars disappearing Dim WshShell Set WshShell = CreateObject("WScript.Shell") WshShell.Run AppToRun, 6 Dim objShell Dim objShellWindows Set objShell = CreateObject("Shell.Application") Set objShellWindows = objShell.Windows Dim ieStarted ieStarted = False Dim ieError ieError = False Dim seconds seconds = 0 While (Not ieStarted) And (Not ieError) And (seconds < 30) If (Not objShellWindows Is Nothing) Then Dim objIE Dim IE 'For each IE object For Each objIE In objShellWindows If (Not objIE Is Nothing) Then If IsObject(objIE.Document) Then Set IE = objIE.Document 'For each IE object that isn't an activex control If VarType(IE) = 8 Then If IE.Title = EmptyTitle Then If Err.Number = 0 Then IE.Write LoadingMessage objIE.Toolbar = 0 objIE.StatusBar = 1 objIE.Navigate2 AppURL ieStarted = True Else 'To see the full error comment out On Error Resume Next on line 1 MsgBox ErrorMessage Err.Clear ieError = True Exit For End If End If End If End If End If Set IE = Nothing Set objIE = Nothing Next End If WScript.sleep 1000 seconds = seconds + 1 Wend Set objShellWindows = Nothing Set objShell = Nothing 'Activate the IE window and restore it success = WshShell.AppActivate(AboutBlankTitle) If success Then WshShell.SendKeys "% r" 'restore End If