Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Web Browser Control | Excel Programming | |||
Dimension Level & Member Browser Control | Excel Programming | |||
excel 2003 browser control?? | Excel Programming | |||
Error "Permission denied" when printing Web Browser control from button on userform, | Excel Programming | |||
Loading a web page on a web browser control | Excel Programming |