需要在win7 64biz上永久启动IE9 inprivate模式

时间:2012-03-04 09:12:43

标签: windows vba windows-7 internet-explorer-9

我已经发现以下注册表项将(通常)永久启动IE9 inprivate模式

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Safety\PrivacIE]
"FilteringMode"=hex(b):01,00,00,00,00,00,00,00

(我之前在我的注册表中没有安全密钥并手动添加)

不幸的是,这似乎不适用于windows7 64bit

使用-inprivate添加快捷方式对我来说不是一个选项,因为我想通过VBA使用IE9

任何提示/建议?

1 个答案:

答案 0 :(得分:1)

从各地拼凑而成:

Dim sh As Object, oWin As Object, IE As Object
Dim wss As Object

Set wss = CreateObject("WScript.Shell")
Set sh = CreateObject("Shell.Application")

wss.exec "%ProgramFiles%/Internet Explorer/iexplore.exe -private"     
''You will probably need a delay here
For Each oWin In sh.Windows
    If TypeName(oWin.Document) = "HTMLDocument" Then
        Set IE = oWin
        Exit For
    End If
Next

With IE
    .navigate "http://stackoverflow.com"

    Do While .busy
        DoEvents
    Loop
    Do While .readystate <> 4
        DoEvents
    Loop
End With