Link to home
Create AccountLog in
Avatar of Takamine334
Takamine334Flag for United States of America

asked on

WebBrowser Document Help

If I say:
wb.document.all("somevaluehere").value = "asdf"

then the textbox called "somevaluehere" gets the value "asdf" written to it.

Why doesn't this work?


Private Sub Whatever()
'the below variable is getting a list of values
'from an HTML page
Dim varSomething() as string
 
wb.document.all(varSomething(0)).value = "asdf"
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of EDDYKT
EDDYKT
Flag of Canada image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Takamine334

ASKER

So, I have to reDim all the variables? 1,2.3,4, etc?
?
yes ie

ReDim Preserve varSomething(0)
ReDim Preserve varSomething(1)
ReDim Preserve varSomething(2)

or if you know how many variable to store i.e. 10

you can
ReDim Preserve varSomething(9)   '0-9
It's much better to use this method:
Public wbDoc As HTMLDocument
Set wbDoc = wb.Document

wbDoc.all(varSomething(x)).value = "asdf"