shaine321
02-24-2017, 04:22 PM
Evening! New to forum so take it easy on me!
Learnt loads off here already but stuck on one thing - the GetelementbyID!
Using Excel to open up Website, log in, pull of report.
There are two buttons on the website - 'Display' and 'Excel'
Display Code:
<button id="Display_Button" language="javascript" onmouseup="className='Highlight';" onmouseleave="className='';" onmouseover="Hand(this)" onclick="if (FT_FinalTest()) { __doPostBack('Display','') }" class="" style="height: 22px; width: 75px; z-index: 1000; left: 942px; top: 130px; position: absolute; cursor: pointer;" tabindex="25" onmouseenter="className='Highlight';Hand(this)" onmousedown="className='Clicked';">Display</button>
Excel Code:
<button id="Excel_Button" language="javascript" onmouseup="className='Highlight';" onmouseleave="className='';" onmouseover="Hand(this)" class="" style="height: 22px; width: 75px; z-index: 1000; left: 942px; top: 98px; position: absolute; cursor: pointer;" tabindex="26" onmouseenter="className='Highlight';Hand(this)" onmousedown="className='Clicked';" doonclick="__doPostBack('Excel','')">Excel</button>
I use the below code to click Display and it works fine
ie.document.getElementById("Display_Button").Click
Now to click the Excel Button I would have assumed swapping the Display_Button out for Excel_Button would work, but it doesn't
Am I missing something? Does a Reference need to be ticked that isn't already?
Displays the error - Run Time Error 5002 - Application defined or Object Defined Error
I have tried numerous methods such as Set A = ie.document.getElementById("Excel_Button") followed by A(0). click and submit, along with getelementsbyclassname but to no avail
Many thanks for any help
Regards
Learnt loads off here already but stuck on one thing - the GetelementbyID!
Using Excel to open up Website, log in, pull of report.
There are two buttons on the website - 'Display' and 'Excel'
Display Code:
<button id="Display_Button" language="javascript" onmouseup="className='Highlight';" onmouseleave="className='';" onmouseover="Hand(this)" onclick="if (FT_FinalTest()) { __doPostBack('Display','') }" class="" style="height: 22px; width: 75px; z-index: 1000; left: 942px; top: 130px; position: absolute; cursor: pointer;" tabindex="25" onmouseenter="className='Highlight';Hand(this)" onmousedown="className='Clicked';">Display</button>
Excel Code:
<button id="Excel_Button" language="javascript" onmouseup="className='Highlight';" onmouseleave="className='';" onmouseover="Hand(this)" class="" style="height: 22px; width: 75px; z-index: 1000; left: 942px; top: 98px; position: absolute; cursor: pointer;" tabindex="26" onmouseenter="className='Highlight';Hand(this)" onmousedown="className='Clicked';" doonclick="__doPostBack('Excel','')">Excel</button>
I use the below code to click Display and it works fine
ie.document.getElementById("Display_Button").Click
Now to click the Excel Button I would have assumed swapping the Display_Button out for Excel_Button would work, but it doesn't
Am I missing something? Does a Reference need to be ticked that isn't already?
Displays the error - Run Time Error 5002 - Application defined or Object Defined Error
I have tried numerous methods such as Set A = ie.document.getElementById("Excel_Button") followed by A(0). click and submit, along with getelementsbyclassname but to no avail
Many thanks for any help
Regards