用宏而不是IE打开谷歌浏览器


0

我有一个关于VB宏的问题,它在IE 11中自动打开一个文件。问题是我无法让下载提示消失(相信我,我已经尝试了从IE中的工具,到regedit,到gpedit.msc的所有内容) 。是否有可能让这个宏做同样的事情,而不是从IE保存/打开以保存谷歌Chrome(可以摆脱下载提示)。我所熟悉的代码是:

选项明确

Public Sub Press_Button()

Dim objIE As SHDocVw.InternetExplorer 'microsoft internet controls (shdocvw.dll)
Dim htmlDoc As MSHTML.HTMLDocument 'Microsoft HTML Object Library
Dim htmlInput As MSHTML.HTMLInputElement
Dim htmlColl As MSHTML.IHTMLElementCollection

Set objIE = New SHDocVw.InternetExplorer

With objIE
    .Navigate "https://Somewebsite.com" ' Main page
    .Visible = 1
    Do While .READYSTATE <> 4: DoEvents: Loop
        Application.Wait (Now + TimeValue("0:00:02"))

         'set user name and password
        Set htmlDoc = .document
        Set htmlColl = htmlDoc.getElementsByTagName("INPUT")
        Do While htmlDoc.READYSTATE <> "complete": DoEvents: Loop
            For Each htmlInput In htmlColl
                If htmlInput.Name = "client_no" Then
                    htmlInput.Value = "xxxxx"
                Else
                    If htmlInput.Name = "password" Then
                        htmlInput.Value = "xxxxx"
                    End If
                End If
            Next htmlInput

             'click login
            Set htmlDoc = .document
            Do While htmlDoc.READYSTATE <> "complete": DoEvents: Loop
            Set htmlColl = htmlDoc.getElementsByTagName("button")
                For Each htmlInput In htmlColl
                    If htmlInput.Name = "login" Then
                        htmlInput.Click
                        Exit For
                    End If
                Next htmlInput
            End With

            Do While htmlDoc.READYSTATE <> "complete": DoEvents: Loop
            Set htmlColl = htmlDoc.getElementsByTagName("button")
                For Each htmlInput In htmlColl
                    If htmlInput.Name = "export" Then
                        htmlInput.Click
                        Exit For
                    End If
                Next htmlInput

        End Sub

有谁知道我能在这做什么。我讨厌IE所以请不要给我任何IE解决方案。非常感谢您的帮助。虽然我也可以使用一段允许激活“保存”按钮的代码。我需要每15分钟下载一个文件,如果每次我必须单击保存本身并且微软已经将这个简单的任务复杂化为f..k并且即使你按照指令它仍然不起作用我也不能这样做。请帮忙

问候


也许这篇文章可以帮助你一点点。我看到你要去的方向。stackoverflow.com/questions/5915325 / ...
NetworkKingPin 2016年

@NetworkKingPin:我在你的回复中尝试了这段代码,但现在它无法正常工作。还有其他想法吗?
丹尼尔

@NetworkKingPin我甚至会在下载对话框中点击IE11中的保存按钮的代码。是否有这样的代码,也有效,我一直在寻找互联网的广泛,但我发现似乎没有任何工作
丹尼尔
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.