ie9 VBA to refresh browser issue

dantheman9

Board Regular
Joined
Feb 5, 2011
Messages
175
hi im trying to automate a refresh process from excel for an ie9 browser.
but i get a client disconeected error when the code gets to the refresh command...relevent bits below;

Code:
Public Browser As Object
 
Sub start()
Dim WebPageDirectory As String
WebPageDirectory = Environ("appdata") & "\Race Creator\Temp.htm"
OpenBrowser WebPageDirectory
Timerun = Now() + TimeValue("00:00:20")
Application.OnTime Timerun, "refreash"
 
End Sub
 
Function OpenBrowser(tmpURL)
Set browser = CreateObject("InternetExplorer.Application")
If browser.Addressbar = True Then
browser.Addressbar = False
End If
If browser.StatusBar = True Then
browser.StatusBar = False
End If
If browser.Toolbar = True Then
Browser.Toolbar = False
End If
If browser.MenuBar = True Then
browser.MenuBar = False
End If
browser.Resizable = True
browser.Visible = True
browser.Navigate (tmpURL)
End Function
 
Sub refreash()
 
With Browser
.refresh
End With
 
End Sub
 
thanks Norie,

I think i don't quite understand what needs a watch adding?

I have set one for the Public Browser Object - that returns no values.

then on XP with ie 8 it returns a value of windows internet explorer.

is that what you mean?
 
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
There is only one object variable for the browser - Browser.

By the way it still isn't clear where the code is located.

It should not be in the ThisWorkbook module.
 
Upvote 0
right so it works ok when the create object is used in the function section;
expression: browser
Value: "Windows Internet Explorer"
Type: Object/IWebBrowser2
Context: Module 1

then after the end of the function all values for Browser are reset to nothing, so i need to add something in the fuction to make sure it gets passed to the Public location?
 
Upvote 0
So have you moved all code, including any declarations outside the ThisWorkbook module?
 
Upvote 0
Well I don't know what the problem is.

It could be something to do with the browser, perhaps not the version but the settings.

Why are you refreshing the page anyway, it is only a text file?
 
Upvote 0
ok, i'll have to look and see if ie9 might be blocking it somehow.
the text file is updated with new information at set intervals, so i just needed a way to automate the refresh for a remote screen.

strangley enough, this all works fine on WinXP running ie8, just seems to not be playing on ie9/win7.

thanks for your time with it :)
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,702
Members
452,938
Latest member
babeneker

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