Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default WEB Browser Control

We have a spreadsheet with a Web Browser Control in it.
Our macro moves thru different pages on the control using
code something like this

Worksheets
(1).WebBrowser1.Navigate "https:/company/homepage.com/docs
/VendList.cmd"

We then inserted the following code to cycle thru until
the page is displayed.

Do While Not intReadyState = 4
intReadyState = Worksheets(1).WebBrowser1.ReadyState
Loop

The nect code resets the ReadyState to 0 to begin the
navigation to the next panel.

intReadyState = 0

Something is not right. The new page is not displaying in
the Web Browser Control unless I hit CTL+ALT+DEl and then
click on debug.

Once I do this then the "new" page is displayed or the Web
Browser Control appears to be refreshed with the new page.

This is our first attempt to use this control and any
suggestions on making this run better would be
appreciated. Thanks for the help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default WEB Browser Control

Hi

Your approach is unfamiliar to me, but I believe, from a glance, that the
loop uses all available CPU cycles and prevents the control from doing its
job. I can praise Visual Basic for days, but handling parallell processes is
not what it does best -or does at all.

There are several useful events in this control, I use these a lot:

WebBrowser1_StatusTextChange
WebBrowser1_BeforeNavigate2
WebBrowser1_DocumentComplete

So I suggest you trig the desired "go on" action from DocumentComplete.

HTH. Best wishes Harald

"JT" skrev i melding
...
We have a spreadsheet with a Web Browser Control in it.
Our macro moves thru different pages on the control using
code something like this

Worksheets
(1).WebBrowser1.Navigate "https:/company/homepage.com/docs
/VendList.cmd"

We then inserted the following code to cycle thru until
the page is displayed.

Do While Not intReadyState = 4
intReadyState = Worksheets(1).WebBrowser1.ReadyState
Loop

The nect code resets the ReadyState to 0 to begin the
navigation to the next panel.

intReadyState = 0

Something is not right. The new page is not displaying in
the Web Browser Control unless I hit CTL+ALT+DEl and then
click on debug.

Once I do this then the "new" page is displayed or the Web
Browser Control appears to be refreshed with the new page.

This is our first attempt to use this control and any
suggestions on making this run better would be
appreciated. Thanks for the help.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default WEB Browser Control

Thanks for the info. Since this is the first time, I am
using the DocumentComplete event, I was wondering if you
could give me an enample of how to use this event?
Thanks for the help.
-----Original Message-----
Hi

Your approach is unfamiliar to me, but I believe, from a

glance, that the
loop uses all available CPU cycles and prevents the

control from doing its
job. I can praise Visual Basic for days, but handling

parallell processes is
not what it does best -or does at all.

There are several useful events in this control, I use

these a lot:

WebBrowser1_StatusTextChange
WebBrowser1_BeforeNavigate2
WebBrowser1_DocumentComplete

So I suggest you trig the desired "go on" action from

DocumentComplete.

HTH. Best wishes Harald

"JT" skrev i melding
...
We have a spreadsheet with a Web Browser Control in it.
Our macro moves thru different pages on the control

using
code something like this

Worksheets

(1).WebBrowser1.Navigate "https:/company/homepage.com/docs
/VendList.cmd"

We then inserted the following code to cycle thru until
the page is displayed.

Do While Not intReadyState = 4
intReadyState = Worksheets(1).WebBrowser1.ReadyState
Loop

The nect code resets the ReadyState to 0 to begin the
navigation to the next panel.

intReadyState = 0

Something is not right. The new page is not displaying

in
the Web Browser Control unless I hit CTL+ALT+DEl and

then
click on debug.

Once I do this then the "new" page is displayed or the

Web
Browser Control appears to be refreshed with the new

page.

This is our first attempt to use this control and any
suggestions on making this run better would be
appreciated. Thanks for the help.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default WEB Browser Control

Private Sub CommandButton1_Click()
Dim S As String
S = InputBox("URL:")
If S < "" Then WebBrowser1.Navigate S
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As
Variant)
MsgBox WebBrowser1.LocationURL & " is fully loaded"
End Sub

It would be easier to assist if you posted what you want the webbrowser to
do for you. Anyway, that whatever would be placed where the Msgbox code is
at the moment.

HTH. Best wishes Harald

"JT" skrev i melding
...
Thanks for the info. Since this is the first time, I am
using the DocumentComplete event, I was wondering if you
could give me an enample of how to use this event?
Thanks for the help.
-----Original Message-----
Hi

Your approach is unfamiliar to me, but I believe, from a

glance, that the
loop uses all available CPU cycles and prevents the

control from doing its
job. I can praise Visual Basic for days, but handling

parallell processes is
not what it does best -or does at all.

There are several useful events in this control, I use

these a lot:

WebBrowser1_StatusTextChange
WebBrowser1_BeforeNavigate2
WebBrowser1_DocumentComplete

So I suggest you trig the desired "go on" action from

DocumentComplete.

HTH. Best wishes Harald

"JT" skrev i melding
...
We have a spreadsheet with a Web Browser Control in it.
Our macro moves thru different pages on the control

using
code something like this

Worksheets

(1).WebBrowser1.Navigate "https:/company/homepage.com/docs
/VendList.cmd"

We then inserted the following code to cycle thru until
the page is displayed.

Do While Not intReadyState = 4
intReadyState = Worksheets(1).WebBrowser1.ReadyState
Loop

The nect code resets the ReadyState to 0 to begin the
navigation to the next panel.

intReadyState = 0

Something is not right. The new page is not displaying

in
the Web Browser Control unless I hit CTL+ALT+DEl and

then
click on debug.

Once I do this then the "new" page is displayed or the

Web
Browser Control appears to be refreshed with the new

page.

This is our first attempt to use this control and any
suggestions on making this run better would be
appreciated. Thanks for the help.



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default WEB Browser Control

Harald.......Thanks for the help. What I'm trying to do
is navigate through a series of web pages (displayed on
the WebBrowser Control on an Excel sheet). Sometimes data
is entered and sometimes a button is just selected.

What I'm looking for is code that will allow the macro to
move on once the page has been completely loaded. (I'm
trying the DocumentComplete event but I don't have the
syntax right yet.)

Here is a sample of what I am trying to do:

Dim IElem As HTMLInputElement
Set WebDoc = Worksheets(1).WebBrowser1.Document

For Each IElem In WebDoc.forms(0).elements

Select Case IElem.Name
Case "PrincipalName"
IElem.Value = ShopNum
End Select

Next IElem

intReadyState = 0

Worksheets(1).WebBrowser1.Navigate "javascript:validate
(document.keyForm);"

(Note: below is my attempt to cycle through a loop until
the ReadyState = 4) at which point the macro would move on
to the next statement. Once ReadyState = 4, we assumed
that it meant the page had finished loading. However, it
just keeps cycling through the loop until I use CTRL +
Break.)

Do While Not intReadyState = 4
intReadyState = WebDoc.ReadyState
Loop

intReadyState = 0

(Note: this is the point where I am looking for code that
will allow the macro to continue once the page has loaded.)

Thanks for all of the help and suggestions with this
issue....JT


-----Original Message-----
Private Sub CommandButton1_Click()
Dim S As String
S = InputBox("URL:")
If S < "" Then WebBrowser1.Navigate S
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As

Object, URL As
Variant)
MsgBox WebBrowser1.LocationURL & " is fully loaded"
End Sub

It would be easier to assist if you posted what you want

the webbrowser to
do for you. Anyway, that whatever would be placed where

the Msgbox code is
at the moment.

HTH. Best wishes Harald

"JT" skrev i melding
...
Thanks for the info. Since this is the first time, I am
using the DocumentComplete event, I was wondering if you
could give me an enample of how to use this event?
Thanks for the help.
-----Original Message-----
Hi

Your approach is unfamiliar to me, but I believe, from

a
glance, that the
loop uses all available CPU cycles and prevents the

control from doing its
job. I can praise Visual Basic for days, but handling

parallell processes is
not what it does best -or does at all.

There are several useful events in this control, I use

these a lot:

WebBrowser1_StatusTextChange
WebBrowser1_BeforeNavigate2
WebBrowser1_DocumentComplete

So I suggest you trig the desired "go on" action from

DocumentComplete.

HTH. Best wishes Harald

"JT" skrev i

melding
...
We have a spreadsheet with a Web Browser Control in

it.
Our macro moves thru different pages on the control

using
code something like this

Worksheets


(1).WebBrowser1.Navigate "https:/company/homepage.com/docs
/VendList.cmd"

We then inserted the following code to cycle thru

until
the page is displayed.

Do While Not intReadyState = 4
intReadyState = Worksheets

(1).WebBrowser1.ReadyState
Loop

The nect code resets the ReadyState to 0 to begin the
navigation to the next panel.

intReadyState = 0

Something is not right. The new page is not

displaying
in
the Web Browser Control unless I hit CTL+ALT+DEl and

then
click on debug.

Once I do this then the "new" page is displayed or

the
Web
Browser Control appears to be refreshed with the new

page.

This is our first attempt to use this control and any
suggestions on making this run better would be
appreciated. Thanks for the help.



.



.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default WEB Browser Control

Javascript ? I believe you're out of luck; you want two pieces of code to
interact when one is from Venus and the other from Mars.

I did explain why you can't use a loop like that in my initial reply though.
The loop prevents your computer from working with other things, like
completing webpages.

HTH. Best wishes Harald

"JT" skrev i melding
...
Harald.......Thanks for the help. What I'm trying to do
is navigate through a series of web pages (displayed on
the WebBrowser Control on an Excel sheet). Sometimes data
is entered and sometimes a button is just selected.

What I'm looking for is code that will allow the macro to
move on once the page has been completely loaded. (I'm
trying the DocumentComplete event but I don't have the
syntax right yet.)

Here is a sample of what I am trying to do:

Dim IElem As HTMLInputElement
Set WebDoc = Worksheets(1).WebBrowser1.Document

For Each IElem In WebDoc.forms(0).elements

Select Case IElem.Name
Case "PrincipalName"
IElem.Value = ShopNum
End Select

Next IElem

intReadyState = 0

Worksheets(1).WebBrowser1.Navigate "javascript:validate
(document.keyForm);"

(Note: below is my attempt to cycle through a loop until
the ReadyState = 4) at which point the macro would move on
to the next statement. Once ReadyState = 4, we assumed
that it meant the page had finished loading. However, it
just keeps cycling through the loop until I use CTRL +
Break.)

Do While Not intReadyState = 4
intReadyState = WebDoc.ReadyState
Loop

intReadyState = 0

(Note: this is the point where I am looking for code that
will allow the macro to continue once the page has loaded.)

Thanks for all of the help and suggestions with this
issue....JT


-----Original Message-----
Private Sub CommandButton1_Click()
Dim S As String
S = InputBox("URL:")
If S < "" Then WebBrowser1.Navigate S
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As

Object, URL As
Variant)
MsgBox WebBrowser1.LocationURL & " is fully loaded"
End Sub

It would be easier to assist if you posted what you want

the webbrowser to
do for you. Anyway, that whatever would be placed where

the Msgbox code is
at the moment.

HTH. Best wishes Harald

"JT" skrev i melding
...
Thanks for the info. Since this is the first time, I am
using the DocumentComplete event, I was wondering if you
could give me an enample of how to use this event?
Thanks for the help.
-----Original Message-----
Hi

Your approach is unfamiliar to me, but I believe, from

a
glance, that the
loop uses all available CPU cycles and prevents the
control from doing its
job. I can praise Visual Basic for days, but handling
parallell processes is
not what it does best -or does at all.

There are several useful events in this control, I use
these a lot:

WebBrowser1_StatusTextChange
WebBrowser1_BeforeNavigate2
WebBrowser1_DocumentComplete

So I suggest you trig the desired "go on" action from
DocumentComplete.

HTH. Best wishes Harald

"JT" skrev i

melding
...
We have a spreadsheet with a Web Browser Control in

it.
Our macro moves thru different pages on the control
using
code something like this

Worksheets


(1).WebBrowser1.Navigate "https:/company/homepage.com/docs
/VendList.cmd"

We then inserted the following code to cycle thru

until
the page is displayed.

Do While Not intReadyState = 4
intReadyState = Worksheets

(1).WebBrowser1.ReadyState
Loop

The nect code resets the ReadyState to 0 to begin the
navigation to the next panel.

intReadyState = 0

Something is not right. The new page is not

displaying
in
the Web Browser Control unless I hit CTL+ALT+DEl and
then
click on debug.

Once I do this then the "new" page is displayed or

the
Web
Browser Control appears to be refreshed with the new
page.

This is our first attempt to use this control and any
suggestions on making this run better would be
appreciated. Thanks for the help.



.



.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Browser Control JT[_2_] Excel Programming 1 September 3rd 04 10:01 PM
Dimension Level & Member Browser Control Lawrence Orchard Excel Programming 1 August 10th 04 01:05 PM
excel 2003 browser control?? Fred Jacobowitz Excel Programming 0 August 4th 04 04:14 PM
Error "Permission denied" when printing Web Browser control from button on userform, Charles Jordan Excel Programming 0 July 8th 04 04:19 PM
Loading a web page on a web browser control Aaron[_10_] Excel Programming 4 January 6th 04 01:11 PM


All times are GMT +1. The time now is 10:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"