PDA

View Full Version : Carrying over the Textfield value to the web browser



sk_uc04
09-24-2007, 02:30 PM
Hello everybody,

I am trying to open a web browser for example www.google.com (http://www.google.com) and in the search field want to have the text/value of the textfield on my word document.

For eg:
On the word document, I have word "Yoga" entered in on of my text fields and when I press/enter Alt+F1, a web browser http://www.google.com opens. Now I want word "Yoga" entered in the google search text field.

Is there a way to carry the text field value in a session to take to web browser? I am kind of lost and not sure what to do about that.
Thanks everybody for the guidance and help.

Regards,
SK

Nelviticus
09-25-2007, 08:54 AM
Hello SK,

This is actually a very complicated thing to do. You can launch IE and open a web page with VBA but you don't have any more control than that. With Google you can add the search term to the page address but that's the limit. Here's some code to get you started:


Public Sub LaunchIE()

Const sIEPath As String = "C:\Program Files\Internet Explorer\iexplore.exe"
Dim sWebSite As String
Dim sSearch As String
Dim lSuccess As Long

sWebSite = "http://www.google.com/search?q="
sSearch = "yoga"

lSuccess = Shell(sIEPath & " " & sWebSite & sSearch)

If lSuccess > 0 Then
' IE opened successfully
Else
' IE failed to open
End If

End Sub
Regards