Web

F

fi.or.jp.de

Hi All,

I have table in web page with check box for each row.

And there is one option called "view", it is been disabled.

When i manually click the check boxes "view" button enables but when i
do
it on Excel Vba its not enabled.

check box code ..

For Each itm In ie.Document.getElementsByName("html_ckb_list")
itm.Checked = True
Next itm

How Can i enable "view" button ?

And also i need to copy the table to excel sheet ?

How can i achieve this.

I need to login web page and need to go for some other tabs to grab
this info.
So, I didn't mentioned the web address.

I know without web address it is difficult but any small clues will
help me more. i will try
for the rest, just give me hints to enable button and copy table
contents.

Thanks in advance.
 
R

ron

Hi All,

I have table in web page with check box for each row.

And there is one option called "view", it is been disabled.

When i manually click the check boxes "view" button enables but when i
do
it on Excel Vba its not enabled.

check box code ..

For Each itm In ie.Document.getElementsByName("html_ckb_list")
    itm.Checked = True
Next itm

How Can i enable "view" button ?

And also i need to copy the table to excel sheet ?

How can i achieve this.

I need to login web page and need to go for some other tabs to grab
this info.
So, I didn't mentioned the web address.

I know without web address it is difficult but any small clues will
help me more. i will try
for the rest, just give me hints to enable button and copy table
contents.

Thanks in advance.

There are a couple of ways to check a check box, maybe one of the
other ways will better simulate manually clicking the box. Check the
source code for the name of the check box you want to select and then
try

ie.document.all.Item("chk_box_name").Click

or

check_bx = ie.document.all.Item("chk_box_name").Checked

As for copying the table try the following

Set doc_tables = ie.document.getElementsByTagname("table")
ActiveCell = doc_tables(0).innertext

If there is more than one table you'll have to find the correct
(number) for the table you want. Also, if you just want part of the
table try the following constructions

To capture a row
ActiveCell = doc_tables(0).Rows(5).innertext

To capture part of a row
ActiveCell = doc_tables(0).Rows(5).Cells(5).innertext

Hope this helps...Ron
 
J

Joel

You may not need enable the view button. I think you want the link location
which is probably in the href property. You can then take the URL from the
href property to get the object. You may want to open a 2nd IE explorer and
put the URL obtained from the href into the 2nd IE so you still can go back
to the original URL without having to naviage back to the 1st URL.
 
F

fi.or.jp.de

Ron, absolutely fine.

I am able get the table data into excel sheet.

I have tested for single row, which contains 3 tabs.

all the tabs data came in a single cell. how can i make it to
different columns.


Joel,

I didn't find href property

source code

<li class="pageButtons" id="summary_view_list">
<input class="buttonDefaultDisabled" type="button"
id="summary_view_button" name="html_but_view" disabled="disabled"
value=" View " title="View" onclick="submitNewAction
(document.html_form_list,'InstitutionAccount');"/>
</li>
 
F

fi.or.jp.de

Sorry ron, i got it.

I didn't tested the second code you have given, just now tested works
fine.

I used like this, thank you very much ron....

Set Shtn = Sheets("sheet2")
Set doc_tables = ie.Document.getElementsByTagName("table")

For i = 1 To 15
For j = 1 To 3
ACell = doc_tables(1).Rows(i).Cells(j).innerText
Shtn.Cells(i, j) = ACell
Next j
Next i

one more, How do i check how many rows are available in a table ?

And "View" button still disabled i don't know why ? even after check
box checked.
 
J

Joel

Use for each

for each Myrow in doc_tables(1).rows
for each cell in Myrows.Cells
ACell = cell.innertext
next cell
next Myrow



ACell = doc_tables(1).Rows(i).Cells(j).innerText
 
F

fi.or.jp.de

Hey Joel,

I was using break mode & checking each code. for that reason
it was not enabled i guess.

Now just now tested without putting any break, view button enabled.

Thanks joel.

Joel, How do i check how many rows are available in a table ?
 
F

fi.or.jp.de

Joel, thank you

is there any option in coding when ever the table is been copied,
as usual it paste in excel. I want another copy in Text.txt format. ?
 
J

Joel

the easiest way is to make a copy of the worksheet and save as text.

'copy active sheet to new workbook
'copy without before or after creates new workbook
ActiveSheet.Copy
Set Newbk = ActiveWorkbook
Newbk.SaveAs _
Filename:="C:\TEMP\Book2.txt", _
FileFormat:=xlTextMSDOS
Newbk.Close savechanges:=False
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top