Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to close an internet connection?

Status
Not open for further replies.

rvBasic

Programmer
Oct 22, 2000
414
BE
I recently performed a webquery from vba. The coding went somehow like this:

Dim Wkb as WorkBook
Dim QT as QueryTable

Set Wkb = Workbooks.Add
With Wkb.Worksheets(1)
Set QT = .QueryTables.Add(Connection:= "URL; Destination:= .Range("A1"))
End With

With QT
.WebSelectionType = xlSpecifiedTables
.WebTables = "2"
...
End With

QT.Refresh BackgroundQuery:= False


A reference to MS EXCEL 10 was set in the project.

The program performed up to my expectations: it did open an internet connection, asked for a password to get through and downloaded the requested table in the worksheet.

However, the connection remained open after the download. Even after the program ended! Obvious question: How can I (or the program's user if he/she desires to do so) close that connection?

The MaintainConnection property seems to work only for OLE DB databases, not for internet connections.

I couldn't find any other method or property within excel'S rich vocabulary to do so. Is the blame on me?
_________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top