View Full Version : Maximize Internet Explorer Window with VBA


ajetrumpet
05-02-2009, 04:35 AM
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: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 = 2Then, when you want to maximize the window (at whatever point you want), write this line of code:apiShowWindow ie.hwnd, SW_MAXIMIZEYou first though, have to declare the IE object and such, but that is how you do it.

seopositive2
05-29-2009, 01:23 PM
try something like this:

At the top of the code window (outside any subs) enter

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:

Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = 1
apiShowWindow objIE.hwnd, SW_MAXIMIZE