Tag: 互联网浏览器

vba – 打开多个网站

请协助解决以下问题。 背景: 我在列B中input25个股票代码。我想自动在Internet Explorer中打开它们。 问题: 运行下面的代码后,它只打开1个Internet Explorer窗口。 而url是“ http://finance.yahoo.com/q?s= ” 我如何能够打开多个Internet Explorer窗口/选项卡,并导航到我想要的股票代码。 而不是只popup一个Internet Explorer窗口? 我的电脑信息: 1.窗口8.1 2.excel 2013 3.ie 11 我的excel参考: 微软对象库:是的 微软互联网控制:是的 Microsoft Form 2.0对象库:是的 微软脚本控制1.0:是的 url: http://finance.yahoo.com/q?s=ibm 以下是我的VBA代码: Private Sub CommandButton1_Click() Dim ie As Object Set ie = CreateObject("InternetExplorer.Application") For r = 2 To 50 With ie .Visible = 1 .navigate "http://finance.yahoo.com/q?s=" & […]

从互联网笨重的打开Excel文档

我正在为我的公司写一个excel vba脚本,并且在顺利运行时遇到了一些麻烦。 为了让我的脚本做到这一点,我需要打开两个在我公司的Intranet上可用的Excel文档。 以下是我目前使用的代码: Sub checkForGrids() Dim IE As Object Dim link As String On Error Resume Next Set groupGrid = Workbooks(Sheet2.Cells(3, 2).value) If groupGrid Is Nothing Then MsgBox ("The Service Area Grid is required for this tool to run. Attempting to open now.") Set IE = CreateObject("InternetExplorer.Application") link = Sheet2.Cells(3, 3) With IE .Visible […]

使用VBA在Microsoft 365电子邮件中按“新邮件”button

我正在尝试通过使用IE作为浏览器的Microsoft 365发送电子邮件。 我目前很难得到VBA创build一个新的电子邮件,并试图通过简单地告诉它点击具有以下HTML代码的“新邮件”button: <button autoid="_n_j" type="button" class="_n_j2 o365button" aria-labelledby="_ariaId_31" regionbehavior="1"> <span class="_n_l2 owaimg ms-Icon–plus ms-bcl-tp ms-bg-transparent ms-icon-font-circle ms-fcl-tp ms-icon-font-size-20-circle" role="presentation"></span> <span class="_n_k2 ms-font-weight-regular ms-font-color-themePrimary" id="_ariaId_31">New mail</span> </button> 我正在尝试使用以下VBA代码按此: Dim objButton As Object Set objButton = IE.Document.getElementById("_n_j2 o365button") objButton.onfocus objButton.onclick 但是我得到一个运行时错误。 我认为这是因为button是使用JavaScript(页面没有重新加载时按下,只是更新)。 任何想法如何做到这一点?

Excel VBA强制closuresIE

我正在使用下面的sub来closures自动化后的IE浏览器: Public Sub CloseIE() Dim Shell As Object Dim IE As Object Set Shell = CreateObject("Shell.Application") For Each IE In Shell.Windows If TypeName(IE.Document) = "HTMLDocument" Then IE.Quit End If Next End Sub 这工作的很好,但是当我尝试再次运行IE代码时出现问题,我得到以下内容: 运行时错误“-2147023706(800704a6)”: 自动化错误 系统关机已经安排完毕。 20秒后,我可以重新运行代码。 有没有什么办法“强行closures”的IE浏览器,以便我可以直接运行后没有错误的代码? 编辑: 下面是启动IE的代码: Sub testSub() Dim IE As Object, Doc As Object, strCode As String Set IE = […]

Excel VBA:如何从Internet Explorer复制一个字段的值

我试图访问Internet Explorer上的表单,然后复制一些字段(我知道那里的名称和ID)的值,并将这些值复制到Excel工作表中。 这是我试图做的简化版本。 所以现在我可以打开我的网页,然后打开包含在其中的子窗体。 但是当我复制我感兴趣的字段的值时,我无法设置variables,因此我可以将其复制回Excel。 这是我的代码如下。 我的问题之间的意见。 Private Sub Open_multiple_sub_pages_from_main_page() Dim i As Long Dim IE As Object Dim Doc As Object Dim objElement As Object Dim objCollection As Object ' Create InternetExplorer Object Set IE = CreateObject("InternetExplorer.Application") ' You can uncoment Next line To see form results IE.Visible = True ' Send the form […]

Excel VBA从Internet Explorer复制标签的值

我试图从下面的html代码中检索值“CONGE STATUTAIRE” <span class="DescriptionLabel" id="lblProjectDescription">CONGE STATUTAIRE</span> 我已经试过了 nom_proj = IE.Document.getElementsByClassName("DescriptionLabel")(0).innerText 代码通过这条线没有问题,但nom_proj的值是“”,我希望得到"CONGE STATUTAIRE"的结果。 有谁能告诉我这有什么问题吗? 我的代码的其余部分正在工作,即我可以通过使用getelementbyID方法检索值。 任何帮助将受到欢迎。

使用VBA查找在HTML标签中使用的属性

我通过vbaparsingHTML代码。 而不是阅读HTML文件,即时获取已打开的IE对象和parsingHTML。 现在,我可以获取标签名称及其属性值。 但我无法find使用的属性。 例如, META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-8859-1" 在这个META标签中,我可以通过使用获取属性值 For Each a In ie.document.all.tags("META") Debug.Print a.getAttribute("content") Next 但是我需要“HTTP-EQUIV”,“CONTENT”,“CHARSET”而不是它的值。 有什么办法可以得到标签中使用的属性? 我想了很久。 不能成功。

使用Internet Explorer导航时出现VBA错误

我试图从全国下载一个自营投资/职位/定价表。 代码似乎做我想做的,除了当我尝试select一个特定的帐户(点击)产生“对象所需”的错误, 我以为我有正确的代码告诉我的macros,直到IE准备继续,但显然我失去了一些东西。 在代码中,相关行被突出显示。 如果我在错误行上面input一个STOP,我可以等到我“看到”链接出现,然后“继续”的代码,并按预期运行。 因为这到我的财务帐户,我不能提供用户名和密码,以允许某人复制确切的问题,但这里是代码,错误信息和突出显示。 build议感激。 Option Explicit 'set Reference to Microsoft Internet Controls Sub DownLoadFunds() Dim IE As InternetExplorer Dim sHTML Const sURL As String = "https://www.nationwide.com/access/web/login.htm" Const sURL2 As String = "https://isc.nwservicecenter.com/iApp/isc/app/ia/balanceDetail.do?basho.menuNodeId=12245" Dim wsTemp As Worksheet Set wsTemp = Worksheets("Scratch") Set IE = New InternetExplorer With IE .Navigate sURL .Visible = True […]

使用Excel VBA提交Javascript中的button

我似乎无法提交点击提交或去button。 它似乎是在一个JavaScript,我不知道如何input代码来点击去button。 这是我有什么: Sub FactFinderForm() Dim IE As Object Set IE = CreateObject("InternetExplorer.Application") 'create new instance of IE. use reference to return current open IE if 'you want to use open IE window. Easiest way I know of is via title bar. IE.Navigate "http://factfinder.census.gov/faces/nav/jsf/pages/index.xhtml###" 'go to web page listed inside quotes IE.Visible = True While […]

如何用VBA Excel Internet Explorer按第二个button

我试图按ID“运行报告”的问题是,有两个button具有相同的ID,我想按第二个button。 Set tags = ie.Document.GetElementsByTagname("input") For Each tagx In tags If tagx.Value = "Run report" Then tagx.Click End If Next 这适用于第一个button,但无法find一个方法来按第二个。 任何人有任何提示? 提前致谢