Hazior
Hazior

Reputation: 694

How to refresh IE using VBA

I have been trying to figure out a way to refresh internest explorer through VBA. I have a webpage I need to refresh periodicly and I need VBA or something to refresh it. Do you guys know of a way to get VBA to refresh a webpage?

Upvotes: 3

Views: 25433

Answers (1)

Justin Self
Justin Self

Reputation: 6255

To use this code which applies Early Binding you will need to add a reference to "Microsoft Internet Controls" in the Visual Basic Editor

This code will open IE, go to google, wait for the page to load completely, then refresh.

Sub RefreshPage()

  Dim page As New InternetExplorer      
  page.Navigate "www.google.com"
  page.Visible = True      
  Do
  Loop Until page.ReadyState = READYSTATE_COMPLETE
  page.Refresh

End Sub

Upvotes: 2

Related Questions