Web Query not working in Excel 2007

P

pedro_mpa

Hi.

I need help on a Web Query in the following VBA code working in Excel 2003
but not on Excel 2007 where the time for query never ends, it just hangs
forever. The excel file is in Office 2003 format (.xls).
Everything works fine in office 2003 but not on 2007.

Here is the code.

Public Sub doLocalWebQuery()
Call doWebQuery("http://pc5/s4/cablescad.php")
End Sub

Public Sub doExternalWebQuery()
Call doWebQuery("http://website.com/s4/cablescad.php")
End Sub


Private Sub doWebQuery(sURL As String)

Dim SheetName As String
SheetName = "EXTRACTION_BASE"
Dim Conn
Conn = "URL;" & sURL

Application.ScreenUpdating = False

Worksheets(SheetName).Cells.Clear

If Worksheets(SheetName).QueryTables.Count > 0 Then
Worksheets(SheetName).QueryTables(1).Refresh
Else
With Worksheets(SheetName).QueryTables.Add(Connection:=Conn,
Destination:=Worksheets(SheetName).Cells(1, 1))
.Refresh
End With
End If

Application.ScreenUpdating = True

End Sub

Thanks in advance.
Please apologize my bad English.

Pedro.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top