View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Gary Gary is offline
external usenet poster
 
Posts: 273
Default In VBA, make IE Browser object always in foreground

Chip,

I noticed that although the IE browser is on top, I can not move it or
adjust the scroll bars. If I comment out the €œSetParent IE.Hwnd,
Application.Hwnd€ then I can move the window and adjust the scroll bars.

Is it possible to have the browser window on top AND still be able to
control the scroll bars and move the window.

Hope this makes sense,

Gary


"Chip Pearson" wrote:

In class modules, Sheet modules, and the ThisWorkbook module,
function declares may not be Public. You must declare them as
Private. Just one of the rules of the road.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"gary" wrote in message
...
Hi Chip,

Your suggestion worked great with one small mod. I had to Add
"Private" in
front of the declare SetParent function so as to not get the
"..Declare
statements not allowed as public members of object modules"
error. I don't
understand what this message is telling me. But your suggest
worked great.

Many thanks,

Gary
decalre teh

"Chip Pearson" wrote:

You need to add

IE.Visible = True

to make the browser visible in the first place. To keep the
browser visible within Excel, allowing you to switch between
IE
and Excel without losing the browser, you need to use the
SetParent API call.

In the declarations area of your module (above and outside of
any
procedure), declare the SetParent function.

Declare Function SetParent Lib "user32" (ByVal hWndChild As
Long,
_
ByVal hWndNewParent As Long) As Long

Then, in your procedure, use code like

IE.Visible = True
SetParent IE.Hwnd, Application.Hwnd

This will make IE a child window of the Excel application, and
IE
will float above the worksheet.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"gary" wrote in message
...
I use VBA to create an IE Browser object using code shown
below.
Sometimes the browser comes up minimized and shows flashing
in
the task bar
at the bottom of the screen due to other activities on the
screen.

I need to have the ie object always visible. Is there a
command I can use
to make this happen ?


Set ie = CreateObject("InternetExplorer.Application")
ie.AddressBar = False
ie.MenuBar = False
ie.Toolbar = False
ie.Width = ScreenWidth * 0.55 ' 600
ie.Height = ScreenHeight * 0.98 '750
ie.Left = 0
ie.Top = 0

Thanks,

Gary