Solved

WebBrowser Document Help

Posted on 2008-06-12
7
627 Views
Last Modified: 2008-08-02
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
Comment
Question by:Takamine334
  • 3
  • 2
7 Comments
 
LVL 26

Accepted Solution

by:
EDDYKT earned 500 total points
ID: 21780994

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
 

Author Comment

by:Takamine334
ID: 21783393
So, I have to reDim all the variables? 1,2.3,4, etc?
0
 

Author Comment

by:Takamine334
ID: 21786803
?
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 21787123
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
 

Author Comment

by:Takamine334
ID: 21789298
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question