how to develop macro to download report from online website in excel format

stggst

New Member
Joined
May 21, 2015
Messages
16
I am very new to the macros.I want to know can we develop a macro to download report from online website.based on the names which i can select form drop-down list,i want to download same reports for each name.can i do this using macros. Please help me to do this.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
You need to read up on HTML Scraping. Is the website open to all or does it have username, password etc?
 
Upvote 0
You need to use the code behind the link - go to the webpage and press F12. I can write the first bit for you if you send me the link - I don't need usernames or passwords. Hopefully, with that as a starter then you can do the rest.
 
Upvote 0
For a starter use this:

Code:
Sub test()


' open IE, navigate to the desired page and loop until fully loaded
    Set IE = CreateObject("InternetExplorer.Application")
    my_url = "http://rd.hemaspharma.com/Pharma/Login.aspx?ReturnUrl=%2fPharma"
   
    With IE
        .Visible = True
        .navigate my_url
        .Top = 5
        .Left = 5
        .Height = 600
        .Width = 900
  
    Do Until Not IE.Busy And IE.readyState = 4
        DoEvents
    Loop

    End With

' Input the userid
    IE.document.getElementById("ASPxRoundPanel1_ctl12_txtUserName").Value = "TestName"
    IE.document.getElementById("ASPxRoundPanel1_ctl12_txtPassword").Value = "TestPW"
' Click the "Next" button
    IE.document.getElementById("ASPxRoundPanel1_ctl12_btnLogin").Click

    Do Until Not IE.Busy And IE.readyState = 4
        DoEvents
    Loop
    
    
End Sub

You will need to put the username and password in. On the next page you will need to look at the HTML code and use the link that vds1 provided to extract the data.
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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