View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Incidental Incidental is offline
external usenet poster
 
Posts: 226
Default Access wab page with excel VBA

Hi Madiya

The code below might help you out. The first way would be to select
the element by the ID or Name and then click which is great if you are
working with a button or a set control that is always the same. You
can also run a loop through the links on the page until you find the
one you are looking for and then click it, this is a little more messy
but it will work if you need to click on a link that is controlled by
javascript etc.

example 1

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

'View the web source code to get the ID or Name of the control then
put it inside the quotations in the brackets.

example 2

For Each Lnk In ie.Document.Links

'Debug.Print Mid(Lnk.outerHTML, 10)

If Mid(Lnk.outerHTML, 10, 6) = "Submit" Then

Lnk.Click

End If

Next

'You can change the parameters of the Mid to use more or less of the
links HTML and of course it doesn't have to be the word submit you
look for, the debug line can be used to display the different HTML
links in the immediate window.

Hope this helps you out

Steve