View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Arry Potter Arry Potter is offline
external usenet poster
 
Posts: 5
Default Web Browser Control and Javascript

Dear All,
I have found the solution.Here is a detailed explanaition

Problem : Call VBA routine from Javascript or Pass data from Webpage to
Excel Sheet or passing data from javascript to web browser control

Solution:
To do this add a webbrowser control in excel
OPen the website from which you want to pass the data to the excel
Ask the javascript on this custom page to pass values to the STATUS BAR
From the status bar you can pick it using webbrowser_1 text changed()

Here is an example - sorry cant post the original due to copyright issues

<html
<body
<script type="text/javascript"
var a;
a = 10 ;
window.status = a;
</script
</body
</html

Here the javascript is returning value 10 . I pass this value to the status
bar

In excel I write the following -
Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
If Text < "" Then
RowCount = 1
If Text < "done" Then
Range("A" & RowCount) = Text

End If


End If
End Sub

I first check if there is any text changing in status bar once I realize
that text has changed. I caputre the changed text to a row in excel.

Hope this helps others in need

Regards
Arvind
"Tim Williams" wrote:

Can you post a small representative example of the javascript code ?

Tim

"Arry Potter" wrote in message
...
Hi,

I have a Javascript code inside a webpage in a webbrowser control on a
excel sheet. There is some value in the javascript which I wish to pass to
the Excel sheet.How can I do this

Excel sheet - webrowser control
webbrowser control - opened a webpage
webpage has javascript code - run code and returns a result
result from javascript - back to excel sheet cell

Configuration :
WinXP,IE6,Office 2003

Regards,
Arry