ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Whats wrong with my code? This is a real challenge... (https://www.excelbanter.com/excel-programming/405576-whats-wrong-my-code-real-challenge.html)

[email protected]

Whats wrong with my code? This is a real challenge...
 
I can't seem to figure out how to set the value of the following combo
box on the following website...

http://babelfish.altavista.com/

The combo box controls the translation language combobox and it is
called "lp" but when I refrence it in VBA I get error messages... My
code...

Private Sub CommandButton5_Click()
WebBrowser1.Document.All("lp").value = 36 'Spanish to English
End Sub

I have also tried using the refrenced value...

Private Sub CommandButton5_Click()
WebBrowser1.Document.All("lp").value = "es_en" 'Spanish to English
End Sub

Any help is greatly appreciated!!!

Tim Williams

Whats wrong with my code? This is a real challenge...
 
Try:

WebBrowser1.Document.frmTrText.lp.selectedIndex = 35 'index is zero-based

Tim

wrote in message
...
I can't seem to figure out how to set the value of the following combo
box on the following website...

http://babelfish.altavista.com/

The combo box controls the translation language combobox and it is
called "lp" but when I refrence it in VBA I get error messages... My
code...

Private Sub CommandButton5_Click()
WebBrowser1.Document.All("lp").value = 36 'Spanish to English
End Sub

I have also tried using the refrenced value...

Private Sub CommandButton5_Click()
WebBrowser1.Document.All("lp").value = "es_en" 'Spanish to English
End Sub

Any help is greatly appreciated!!!




[email protected]

Whats wrong with my code? This is a real challenge...
 
On Feb 5, 2:43*am, "Tim Williams" <timjwilliams at gmail dot com
wrote:
Try:

WebBrowser1.Document.frmTrText.lp.selectedIndex = 35 *'index is zero-based

Tim

wrote in message

...



I can't seem to figure out how to set the value of the following combo
box on the following website...


http://babelfish.altavista.com/


The combo box controls the translation language combobox and it is
called "lp" but when I refrence it in VBA I get error messages... My
code...


Private Sub CommandButton5_Click()
WebBrowser1.Document.All("lp").value = 36 'Spanish to English
End Sub


I have also tried using the refrenced value...


Private Sub CommandButton5_Click()
WebBrowser1.Document.All("lp").value = "es_en" 'Spanish to English
End Sub


Any help is greatly appreciated!!!- Hide quoted text -


- Show quoted text -


Tim,

Thank you so much!! I would have never figured that one out. I
don't understand the logic behind the code but I know it works...

Could you please tell me where

frmTrText

came from?

Thanks again!

Tim Williams

Whats wrong with my code? This is a real challenge...
 
Form elements can be referenced like this:

document.formname.elementname

frmTrText is the name of the form which contains the list.

Tim


wrote in message
...
On Feb 5, 2:43 am, "Tim Williams" <timjwilliams at gmail dot com
wrote:
Try:

WebBrowser1.Document.frmTrText.lp.selectedIndex = 35 'index is zero-based

Tim

wrote in message

...



I can't seem to figure out how to set the value of the following combo
box on the following website...


http://babelfish.altavista.com/


The combo box controls the translation language combobox and it is
called "lp" but when I refrence it in VBA I get error messages... My
code...


Private Sub CommandButton5_Click()
WebBrowser1.Document.All("lp").value = 36 'Spanish to English
End Sub


I have also tried using the refrenced value...


Private Sub CommandButton5_Click()
WebBrowser1.Document.All("lp").value = "es_en" 'Spanish to English
End Sub


Any help is greatly appreciated!!!- Hide quoted text -


- Show quoted text -


Tim,

Thank you so much!! I would have never figured that one out. I
don't understand the logic behind the code but I know it works...

Could you please tell me where

frmTrText

came from?

Thanks again!




All times are GMT +1. The time now is 07:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com