Web Query: Obtaining source link from a cell

T

tx12345

Hi

When I create a macro for a web query, the code looks like this:


Code:
--------------------
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.etc.com/mypage.htm" _
, Destination:=Range("C4"))

--------------------


But this macro is only good for one web page. How can I query another
web page without changing the macro, where the new web address come
from a particular cell on the worksheet?

All ideas welcome
Thx
 
M

Michael Gill

Hi,

Assuming cell A1 contains your URL just use the following code:
myQuery = Range("A1").Value
With ActiveSheet.QueryTables.Add(Connection:= _
myQuery _
, Destination:=Range("C4"))

Michael
 

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