gpt4 book ai didi

vba - 如何使用 SHDocVw.InternetExplorer 命令最大化由 VBA 创建的 IE 窗口?

转载 作者:行者123 更新时间:2023-12-03 00:22:11 25 4
gpt4 key购买 nike

正如标题所示,我正在尝试最大化使用以下命令创建的 Internet Explorer 窗口:

Set ie = New SHDocVw.InternetExplorer

而不是:

Set ie = CreateObject("InternetExplorer.Application")
<小时/>

完整代码如下:

Sub wpieautologin()
Dim ie As SHDocVw.InternetExplorer

Dim NOME_EMPRESA, CNPJ, CPF, COD_ACESSO As String
Dim Lookup_Range As Range

Set ie = New SHDocVw.InternetExplorer
ie.Visible = False
ie.Navigate "http://www8.receita.fazenda.gov.br/simplesnacional/controleacesso/autentica.aspx?id=6"

NOME_EMPRESA = Range("B8").Value
Set Lookup_Range = Range("B12:E500")

CNPJ = Application.WorksheetFunction.VLookup(NOME_EMPRESA, Lookup_Range, 2, False)
CPF = Application.WorksheetFunction.VLookup(NOME_EMPRESA, Lookup_Range, 3, False)
COD_ACESSO = Application.WorksheetFunction.VLookup(NOME_EMPRESA, Lookup_Range, 4, False)

Do
Loop Until ie.readystate = 4
Call ie.Document.GetElementByID("ctl00_ContentPlaceHolder_txtCNPJ").SetAttribute("value", CNPJ)
Call ie.Document.GetElementByID("ctl00_ContentPlaceHolder_txtCPFResponsavel").SetAttribute("value", CPF)
Call ie.Document.GetElementByID("ctl00_ContentPlaceHolder_txtCodigoAcesso").SetAttribute("value", COD_ACESSO)
ie.Visible = True

>'What should I write here to maximize my IE Window?
>'Already tried a few solutions, but they works only when the IE is created by the command
>'Set ie = CreateObject("InternetExplorer.Application")

#INSERT COMMAND TO MAXIMIZE WINDOW HERE

End Sub

那么,我怎样才能实现这一目标呢?

最佳答案

也可以这样完成。

ie.FullScreen = True

ie.TheaterMode = True

那么你就不需要声明一个函数。

关于vba - 如何使用 SHDocVw.InternetExplorer 命令最大化由 VBA 创建的 IE 窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41367209/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com