View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default Web query in macro doesn't work until you manually edit it


Moxy:
also note following:

By adding queries instead of modyfying an exiting one,
you should be aware that you build up a lot of dirt
in the names collection.

When you add a querytable an equivalent name object is created.
when you subsequently delete the rows the name object remains.
(but points to non existing rows..

I've seen books with thousands of names...
all created be similar procedures... but there comes a point
the book is going to crash.

So first check and possibly (likely?) clean up the names.
Then clean up your code to something like..

Sub hmm()
Dim qt As QueryTable
Set qt = Worksheets("sheet1").QueryTables(1)
qt.Connection = "URL;http://www.microsoft.com"
qt.Refresh
End Sub

HTH..


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


wrote :