Click Link on Webpage using VBA

mojo215

New Member
Joined
Jan 30, 2008
Messages
9
Hi all,

I'm trying to click a link on a webpage I already have open.

For example say I have google.com open and I wanted to click 'Images' at the top of the page without using the code...

ie.navigate("http://images.google.com/imghp?hl=en&tab=wi")
(I can't use this code b/c the page i'm trying to access requires I click the link)


Is there a way to identify the link on the page by its name and then "click" it?

I've been trying to find code for this all over the place, and it seems impossible to find it...if any one can offer some help I'd appreciate it.

Thanks in Advance
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Sorry but I don't understand.

You seem to be saying you don't want code but then appear to want code.:eek:

What's the problem with using Navigate?
 
Upvote 0
I need VBA code. I just can't use the ie.navigate("www.website.com") I need some other work around because if I just try to navigate to the page it says it has expired and I need to re-login. So i actually have to click it.

I'm wondering if VBA has a way to find the hyperlink and click it.
 
Upvote 0
There probably is a way to 'click' the link, but I've got a feeling that you might end up with the same result. ie page expired

I don't see why you think clicking the link would make any difference.:)
 
Upvote 0
Well I had tried to use Shellobjects to passkeys to IE and did get a link to open that way. However, I have to navigate through several pages, and the last page actually needs to be clicked :confused: I simply can not pass 'Tab' commands to it and hit enter.

Also in general this seems like a very sloppy way of trying to open a link on a page.

Is there any way using VBA to identify links on a page and then click them?

Thanks
 
Upvote 0
You can definitely automate IE using VBA, and you should probably avoid using anything like SendKeys.

Not only is it flaky, it's not needed.:)

But I'm afraid the main issue with this sort of thing is how the webpage/site has been designed.

It's almost impossible to help without at least a valid URL and more information on what you are actually trying to achieve.:)
 
Upvote 0
I'm trying to click a link on a webpage I already have open.

For example say I have google.com open and I wanted to click 'Images' at the top of the page without using the code...
So do you have IE open and it wasn't opened by VBA? If so, use Shell.Windows to find the IE window, set it to an InternetExplorer object and then loop through the IE.Document.Links() array looking for innerText = "Images". Then it's IE.Document.Links(x).Click to click the link.
 
Upvote 0
I wish I could supply the URL, its business related and requires a login. If you have some base code for finding a link I'm sure that would be useful and I could try and adapt that.

As in the example I had above...

I have www.google.com open

Now I want to Click the Hyperlink "Images"
How could this be achieved?


Also another possible work around if they above isn't possible...a way to move the mousepointer to specific part of the screen and then pass a left click through that would work fine for me...

I dunno I've just been at my wits end trying to work this out.

Thanks for the help
 
Upvote 0
Search for the terms in my post - there are plenty of examples. And answering my question would make things clearer.
 
Upvote 0

Forum statistics

Threads
1,214,788
Messages
6,121,603
Members
449,038
Latest member
Arbind kumar

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