Maximize Internet Explorer Window with VBA (1 Viewer)

Status
Not open for further replies.

ajetrumpet

Banned
Local time
Today, 05:33
Joined
Jun 22, 2007
Messages
5,638
There are two ways to maximize the window when running Internet Explorer:

1) Under "RUN" in the property sheet for the IE icon, choose "Maximize" instead of the default, which is "Normal" (only applies to Vista users).

2) Insert this code into a normal module in your database:
Code:
Option Explicit

Declare Function apiShowWindow Lib "user32" Alias "ShowWindow" _
            (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Global Const SW_MAXIMIZE = 3
Global Const SW_SHOWNORMAL = 1
Global Const SW_SHOWMINIMIZED = 2
Then, when you want to maximize the window (at whatever point you want), write this line of code:
Code:
apiShowWindow ie.hwnd, SW_MAXIMIZE
You first though, have to declare the IE object and such, but that is how you do it.
 
Last edited:

seopositive2

New member
Local time
Today, 03:33
Joined
May 29, 2009
Messages
9
try something like this:

At the top of the code window (outside any subs) enter
Code:
Declare Function apiShowWindow Lib "user32" Alias "ShowWindow" _
            (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Global Const SW_MAXIMIZE = 3
Global Const SW_SHOWMINIMIZED = 2
Global Const SW_SHOWNORMAL = 1

Then in your sub procedure, use something like this:
Code:
Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = 1
apiShowWindow objIE.hwnd, SW_MAXIMIZE
 
Last edited by a moderator:
Status
Not open for further replies.

Users who are viewing this thread

Top Bottom