Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 637
  • Last Modified:

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

0
Takamine334
Asked:
Takamine334
  • 3
  • 2
1 Solution
 
EDDYKTCommented:

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

Open in new window

0
 
Takamine334Author Commented:
So, I have to reDim all the variables? 1,2.3,4, etc?
0
 
Takamine334Author Commented:
?
0
 
EDDYKTCommented:
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
0
 
Takamine334Author Commented:
It's much better to use this method:
Public wbDoc As HTMLDocument
Set wbDoc = wb.Document

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

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now