Solved

WebBrowser Document Help

Posted on 2008-06-12
7
635 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month4 days, 17 hours left to enroll

636 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