ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Web Query: Obtaining source link from a cell (https://www.excelbanter.com/excel-worksheet-functions/63779-web-query-obtaining-source-link-cell.html)

tx12345

Web Query: Obtaining source link from a cell
 

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


--
tx12345
------------------------------------------------------------------------
tx12345's Profile: http://www.excelforum.com/member.php...o&userid=24776
View this thread: http://www.excelforum.com/showthread...hreadid=499068


Michael Gill

Web Query: Obtaining source link from a cell
 
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

"tx12345" wrote:


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


--
tx12345
------------------------------------------------------------------------
tx12345's Profile: http://www.excelforum.com/member.php...o&userid=24776
View this thread: http://www.excelforum.com/showthread...hreadid=499068




All times are GMT +1. The time now is 03:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com