Accessing Web page through VBA, not able to execute javascript, need to click image button

Mintx

New Member
Joined
Apr 8, 2011
Messages
7
I need to click a image button on web page which will download the report to excel. There is a javascript which does this, but I have no luck in executing the script, it says some error

Html:
a name="exportdlg" id="exportdlg" href="javascript:docCrystalEvent('doc', 'tb=exportdlg')" >img border=0 name="exportdlgImage" id="exportdlgImage" width=22.0px height=22.0px src='../../viewers/crystalreportviewers115/images/toolbar/export.gif' alt="Export this report" title="Export this report" ***********="this.src='../../viewers/crystalreportviewers115/images/toolbar/export_over.gif'"

VBA code:
objIEReportWindow.document.parentWindow.execScript "docCrystalEvent('doc', 'tb=exportdlg');"
here i m getting error 'Could not perform operation due to error 80020101'

another way i tried to access the image button is
For Each Element In objIEReportWindow.document.getElementsByTagName("a")
MsgBox (Element.innerText) 'to see if i get the required element
'If Element.Value = "Exportdlg" Then Element.click = True
Next

But still no luck yet, this is really getting into my nerves, as I've almost completed the entire automation but stuck here @ the end.

Any help would be highly appreciated...
Thanks in advance
 
Last edited:
It isn't really the image you need to work with

It just seems to be that the image is wrapped in a link , if it were text it would appear more like a link.

If what you've posted so far is to access the report page it shouldn't really matter - that should be possible.

However doing anything with the report might be a different story.

Another problem is that it's kind of hard to help without the URL, as you've seen it's almost impossible to post the HTML.

Do you know if there is a form on the page you use to access the report?

Perhaps you have to make some input on the page then press the link/image/whatever to goto the report?
 
Upvote 0

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
The html page consists a crystal report viewer form embeded

Code for your reference

HTML:
<HTML>
<HEAD>
<TITLE>Crystal Reports Viewer</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
 <form name="docCrystalForm" id="docCrystalForm" method="post" action="../../viewers/rpt/DHTMLViewer.jsp?skin=skin_default&lang=en&sViewerName=doc&id=CUID,ok2kJ9YACaCjB5sAOE6Fbn35cWU&sDocName=untitled&sRepoType=10&sType=rpt&&iDocID=ok2kJ9YACaCjB5sAOE6Fbn35cWU&sIDType=CUID&iDocID=ok2kJ9YACaCjB5sAOE6Fbn35cWU&currReportID=1653580" id="docCrystalForm" enctype="application/x-www-form-urlencoded;charset=utf-8">
 
<a name="exportdlg" id="exportdlg" href="javascript:docCrystalEvent('doc', 'tb=exportdlg')" ><img border=0 name="exportdlgImage" id="exportdlgImage" width=22.0px height=22.0px src='../../viewers/crystalreportviewers115/images/toolbar/export.gif' alt="Export this report" title="Export this report" ***********="this.src='../../viewers/crystalreportviewers115/images/toolbar/export_over.gif'" **********="this.src='../../viewers/crystalreportviewers115/images/toolbar/export.gif'" ></a></td>
<td nowrap width='2.0px'></td><td nowrap valign=center>
<a name="crprint" id="crprint" href="javascript:docCrystalEvent('doc', 'tb=crprint')" ><img border=0 name="crprintImage" id="crprintImage" width=22.0px height=22.0px src='../../viewers/crystalreportviewers115/images/toolbar/print.gif' alt="Print this report" title="Print this report" ***********="this.src='../../viewers/crystalreportviewers115/images/toolbar/print_over.gif'" **********="this.src='../../viewers/crystalreportviewers115/images/toolbar/print.gif'" ></a></td>
<td nowrap width='2.0px'></td><td nowrap valign=center>

And when i see the HTML report page, the top right corner has a image which is used for exporting the report. This image seems to be standard crystal report viewer screen which is opened in IE.

When i try to search the images on this page it returns 0, I checked the IE focus also, which is pointing on this page itself, not sure then why its not retriving any image information from this page.

I hope there should be some way to click the export button on the crystal report form opened in IE
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top