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
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
When are you calling the code to refresh?
 
Upvote 0
it runs in the same module, after an Applcation.On Time command
i get as far as a client dissconneted error on the .refresh line
 
Upvote 0
Have you checked what's happening with the browser when you get the error?
 
Upvote 0
thanks Norie,

as in is it busy?
as far as i can see it's just static.....is there a way to check?
it only loads a text file so not a big file to process at all?
 
Upvote 0
I kind of meant the object variable for the browser in the code, as well as the browser itself.

You can add a watch on it by selecting it and dragging it to the watch window (View>Watch Window) or SHIFT+F9 then Add.
 
Upvote 0
the OpenBrowser Content is addin.Module6.OpenBrowser
Browser content is VBAproject.ThisWorkbook

both give no values for Value (both out on context)
and both types are 'empty'

....i have no idea what that means?
 
Upvote 0
ok so it seems to lose its value that should be 'Windows Internet Explorer"

how can i get it to pass the value into the Public Browser as Object variable?
 
Upvote 0
further to than, when running in XP under ie8, the watcher on Browser gives lots of info including other info on the page etc... is it ie9 thats is playing up?
 
Upvote 0
What do you mean here?

the OpenBrowser Content is addin.Module6.OpenBrowser
Browser content is VBAproject.ThisWorkbook

None of this code should be in the ThisWorkbook module or a worksheet module.
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,678
Members
452,937
Latest member
Bhg1984

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