如何使用SHDocVw.InternetExplorer命令最大化由VBA创建的IE窗口? [英] How can I maximize an IE window created by VBA with SHDocVw.InternetExplorer command?

查看:643
本文介绍了如何使用SHDocVw.InternetExplorer命令最大化由VBA创建的IE窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

As the title says, I'm trying to maximize an internet explorer window that was created using the following command:

Set ie = New SHDocVw.InternetExplorer

代替:

Set ie = CreateObject("InternetExplorer.Application")


这是完整的代码:


Here's the full code:

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

那么,我该如何实现呢?

So, how can I achieve this?

推荐答案

这也可以这样做.

ie.FullScreen = True

ie.TheaterMode = True

然后,您无需声明函数.

Then you don't to declare a function.

这篇关于如何使用SHDocVw.InternetExplorer命令最大化由VBA创建的IE窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆