right click on an HTML hyperlink to save document

jlecl033

New Member
Joined
Feb 7, 2011
Messages
13
Hello all,

I am creating a macro that navigates in a password protected website to fetch information in the form of excel documents. On the website, the user has to press on hyperlinks to get the excel documents.

When manually pressing the hyperlinks with my mouse, the open/save/cancel dialog box appears, which I don't know how to pass yet.

When my code "clicks" the hyperlinks, the information bar pops up, which I don't know how to pass either.

At the moment, I have looked at many forums and I would like to know if it is possible to code a "right-click" so I can Save As the excel document.

At the moment my code, for that part, looks like this:
Code:
sub exceldocfetcher()
Set appIE = New InternetExplorer
sURL = "http://www.energystar.gov/index.cfm?c=evaluate_performance.bus_portfoliomanager"
    'click the energy meter hyperlink
    Set energymeter = appIE.document.getelementsbytagname("a") 'a is the tag name from the source file
    For Each link In energymeter
        If link.innerText = "View All Meter Data in Excel" Then 'the hyperlink
            link.Click
            Exit For
        End If
    Next link
    'loop until the page finishes loading
    With appIE
        Do While .busy Or .ReadyState <> READYSTATE_COMPLETE
        DoEvents
        Loop
    End With
end sub

I know it is hard to give some help with so little information, but a general solution or pointers would be helpful. Thank you
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
When manually pressing the hyperlinks with my mouse, the open/save/cancel dialog box appears, which I don't know how to pass yet.
Try the code I wrote in this thread: http://www.mrexcel.com/forum/showthread.php?t=507871. It automates the whole process of (left-) clicking on a download file hyperlink and handling the series of IE download dialogue windows which appear. The code is also used in http://www.mrexcel.com/forum/showthread.php?t=502298&page=2, with more comments about its usage.
When my code "clicks" the hyperlinks, the information bar pops up, which I don't know how to pass either.
You have to add the web site URL to IE's trusted sites. There is a comment at the top of code describing how to do this.
At the moment, I have looked at many forums and I would like to know if it is possible to code a "right-click" so I can Save As the excel document.
Don't know about right-click, but my code left-clicks on the relevant 'download file' link and then handles the series of IE download windows which appear, in the same way as you would manually.
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,916
Members
449,093
Latest member
dbomb1414

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