Need help making a VBA macro for pulling datd from IE10.

Johnnyv015

New Member
Joined
Sep 8, 2014
Messages
11
Hello all, I am fairly new to this whole VBA programing thing. I have used excel for years however never had much of a need for VBA outside of simple "Plug and Dump" button macros.

However I have now found my self working on a large(seems large to me) task of setting up an automated data pull for my employer.

Due to this being sensitive data I am unable to use the actual links I need however I believe I will be able to explain what I need help on.

I need to create a macro(s) that will

1.) Login to our system
2.) follow links once logged in to pull data from 7 different links and pool this data on separate pages
3.) logout once data has been pulled and is complete.

Also this will all have to be automated to repeat this task ever hour on the half hour. (only during business hours.) - I'm thinking a "Start" and "stop" button will be the easiest approach here.

Only other kicker I have is staggering the data pull on the 7 reports so that this does not crash excel.


If anyone can shoot me some code lines or examples of what direction I should start going with this the help would be greatly appreciated. As of now this is what I have
Code:
Sub Login()

  Dim MyHTML_Element As IHTMLElement
  Dim MyURL As String
  On Error GoTo Err_Clear
  MyURL = "random url"
  Set MyBrowser = New InternetExplorer
  MyBrowser.Silent = True
  MyBrowser.navigate MyURL
  MyBrowser.Visible = True
  Do
  Loop Until MyBrowser.readyState = READYSTATE_COMPLETE
  Set HTMLDoc = MyBrowser.document
  HTMLDoc.all.Name.Value = "123456"
  HTMLDoc.all.Password.Value = "123456"
  For Each MyHTML_Element In HTMLDoc.getElementsByTagName("input")
  If MyHTML_Element.Type = "submit" Then MyHTML_Element.Click: Exit For
  Next
Err_Clear:
  If Err <> 0 Then
  Err.Clear
  Resume Next
  End If
  Resume Next
End Sub
Am I heading in the right direction? I feel lost. Thanks!
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
It's difficult to help without knowing the URL or seeing the HTML, but you seem to be on the right lines. Get rid of all the error handling code because that will hide any errors and you want to see errors as you develop the code. View source or use your browser's developer tools to see the HTML elements and write code accordingly.
 
Upvote 0

Forum statistics

Threads
1,203,379
Messages
6,055,094
Members
444,761
Latest member
lneuberger

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