PDA

View Full Version : click image in web page



geebee
09-16-2008, 06:36 PM
hi,

i already have vba to navigate to a web page. i just need some code to click on an image in the web page. i checked thhe source of the html, and it looks like:

<td><table id="Menu_4_i0" onmouseout="Menu.Out(this);" width="100%" rmCss="MenuItem" rmLab="View Reports" class="MenuItem" onmouseover="Menu.Over(this);" cellspacing="0" rmCssOver="MenuItemOver" cellpadding="0">
<tr onclick="goTo('/Reports/ReportList.asp', '')">
<td width="26"><img src="/Shared/Images/Icons/smallIcon_View.gif"></td>
<td nowrap class="MenuItem">View Reports</td>

so i am trying to figure out how i can use vba to click on the view reports image or item.


thanks in advance,
geebee

akanchu
09-17-2008, 08:19 PM
I am not 100% sure if this can access the img, but can try using HTMLDocument object.
you can search on the net for properties /events.

Hope this helps.

geebee
09-18-2008, 06:24 AM
hi,

i tried...

Dim myDoc As HTMLDocument
Dim formbutton
Set formbutton = myDoc.getElementsByName("view reports")
myDoc.formbutton.Click

gettign a runtime error 438.. object doesnt support this property or method.

any suggestions?



thanks in advance,
geebee

MaximS
09-18-2008, 08:16 AM
maybe you should go directly to the site with report - try this:


Dim ie As Object

Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True

With ie
.navigate "http://www.yourwebsite.co.uk/../" & _
"/Reports/ReportList.asp"
Do While .busy: DoEvents: Loop
Do While .ReadyState <> 4: DoEvents: Loop
End With

geebee
09-18-2008, 09:26 AM
:( hi i tried the recommended syntax..

With ie
.navigate "http://www.yourwebsite.co.uk/../" & _
"/Reports/ReportList.asp"
Do While .busy: DoEvents: Loop
Do While .ReadyState <> 4: DoEvents: Loop
End With

but it is going back to the https://something.something.com/Transactions/Logon.asp?URL=/reports/reportlist.asp&Process=

site with the username and password fields blanked out. would you like to see the source ASP code for the page? it seems like ai am so close but im not sure what to do.

thanks in advance,
geebee

MaximS
09-18-2008, 02:10 PM
paste website address i had similar problem before