VBA to open web page, find text, and click on text's URL link?

C

cstraim

Hello

I noticed a posting with this subject, but i'm new to VBA and I could
not follow the suggestion listed in the response.

I am trying to have VBA open an instance of IE and browse to a specific
URL

Private Sub DrawingIn_Click()
Set browser = CreateObject("InternetExplorer.Application")
browser.Navigate ("www.mywebpage.com")
browser.StatusBar = False
browser.Toolbar = False
browser.Visible = True
browser.Resizable = False
browser.AddressBar = False
End Sub

I got that portion to work

Now I need to search for a hypertext link named "spreadsheet" within
the page i've navigated to. The hyperlink is to download a spreadsheet.
Clicking on it brings up the SaveAS dialog box. I then need to save
the spreadsheet to a specific location.

Can someone please help me complete the code to

1) Find the Spreadsheet hyperlink
2) Click it
3) Save the target into a specified directory.

Thanks again

Cory
 
C

cstraim

Lance Wynn Posted this explanation in the original post:

You can use the WebBrowser control to open the page, and then loop
through
the document("all") collection object, and check each "A" tag's
innerText
property for the search string, if it's the correct string then you can

navigate to the href of the anchor.

Now I just need to know how to do that, I have absolutely no idea what
code to use to get it to do what he suggested

Thanks everyone again :)

Cory
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top