Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Refresh Browser with vba

Dick,

That's great, just what I need.

I had to make a minor change, substitute the "MyFile.htm"
with "MyTitle". Also to ensure the .htm file actually has
a title like:
<TITLEMyTitle</TITLE

Without a title the filename appears in the IE window, but
the code errors when it trys to return .Document.Title

From the SHDocVw object browser I found I can also use
If InStr(1, SWs(i).LocationURL, "MyFile.htm") 0 Then

In my last post I knew I had missed something obvious in
x = Shell("Iexplore.exe C:\Temp\MyFile.htm", 1)

however this seems to work
x = Shell("Explorer C:\Temp\MyFile.htm", 1)
but strangely not "Internet Explorer" as suggested in some
places in this ng, at least not for me.

I've also found the odd hint in this ng that IE can be
automated, might look into this a bit more (for curiosity,
your code already does what I need).

Many thanks for your help,
Sandy
savituk yahoo co uk


-----Original Message-----
Sandy

Set a reference (Tools - References) to Microsoft

Internet Controls. Then
this should work:

Sub Refreshbrowser()

Dim i As Long
Dim SWs As New SHDocVw.ShellWindows

For i = 0 To SWs.Count - 1
If InStr(1, SWs(i).Document.Title, "MyFile.htm") 0

Then
SWs(i).Refresh
Exit For
End If
Next i

End Sub

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Sandy V" wrote in

message
...
Thanks Bob,

I had thought that but the trouble is I want to fire it
from a button on the sheet (refresh IE). I think would
need to somehow find the relevant window, activate it

and
then SendKeys as you suggest.

Another possibility might be to start IE within vba and
load it with "Path\Myfile.html". I guess this would

mean
using Shell although for some reason I can't even get
this to work:

x = Shell("Iexplore.exe C:\Temp\MyFile.htm", 1)
'error 53, File not found (even if I include path to
IE, path\filename are correct)

Assuming I've just missed something obvious in the
above, I don't know thereafter if it's possible to set
reference to it and the next step to refresh it.

Regards,
Sandy


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy Excel functions formula and auto refresh refresh Pauline Cheong Excel Worksheet Functions 3 February 16th 09 01:23 AM
Create refresh button in worksheet to refresh Pivot Table Data Ron Excel Worksheet Functions 1 October 13th 07 01:20 AM
Query Refresh-Enable Automatic Refresh Dialogue Box Terri Excel Discussion (Misc queries) 0 May 6th 05 08:21 PM
Pivot Table REFRESH Flaw -- Saves Old Data in Selection Area AFTER REFRESH Ken Roberts Excel Programming 3 September 11th 03 06:02 AM
Excel does not close from VB!! (when i refresh Refresh query with BackgroundQuery:=False) Anant[_2_] Excel Programming 1 August 6th 03 04:22 AM


All times are GMT +1. The time now is 07:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"