Solved

WebBrowser Document Help

Posted on 2008-06-12
7
629 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

679 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