devendra.dvm
Member
Hi Experts,
Iam working on a project ''Automation IE'', need your help on the same to copy element from ID and paste it in excel. Any help greatly appreciated.
Below is the VBA code so far.
Im able to navigate to webpage, copy element but my code is copying inner HTML code and pasting in Excel(Like below table)
Below is the output with my code
And below table is the output when i copy element manually as shown in below screenshot
Iam working on a project ''Automation IE'', need your help on the same to copy element from ID and paste it in excel. Any help greatly appreciated.
Below is the VBA code so far.
Code:
Sub KBOSS_ARN_Profile()
Set browser = New SHDocVw.InternetExplorer
browser.Visible = True
browser.navigate ("MyURL")
Set Post = .document.getElementById("ctl00_ContentPlaceHolder1_TrAgentDet")
For Each ele In Post.getElementsByTagName("td")
Debug.Print ele.innerHTML
Sheets("Sheet1").Range("G5").Value = ele.innerHTML
Range("G2").Select
browser.Quit
end sub
Im able to navigate to webpage, copy element but my code is copying inner HTML code and pasting in Excel(Like below table)
Below is the output with my code
<table cellpadding="0" cellspacing="0" border="0" class="TableCls" style="width: 100%"> <tbody><tr> <td class="trheader" colspan="2" align="center"> Personal Details </td> </tr> <tr> <td class="TextCls" style="width: 35%"> Agent </td> <td style="width: 65%"> <span id="ctl00_ContentPlaceHolder1_lbl_PD_AgentCode">ARN-5752</span> </td> </tr> <tr> <td class="TextCls" valign="top"> Name </td> <td> <span id="ctl00_ContentPlaceHolder1_lbl_PD_Name">D V Laxman Babu</span> </td> </tr> <tr> |
And below table is the output when i copy element manually as shown in below screenshot
Personal Details | |
Agent | ARN-12345 |
Name | BABU |
Address1 | H.No: 2 - 2 - 46 |
Address2 | Hotel Sri Ganesh |
Address3 | Gandhi Chowk |
City | KHAMMAM |
State | TL |
Country | |
Pin | 507003 |
Off.Phone | |
Res.Phone | xxxxx |
Mobile No | xxxxx |
Fax |
Last edited: