Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Alarmbloke
 
Posts: n/a
Default How to do automatic Web Queries??

Hi,

I would like to be able to import data automatically from a web page without
having to type in the web address.

I can create the correct url path in a cell using a CONCATENATE function but
cannot create a macro which references to that cell for the url look up.

This is the macro as it currently stands


With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.************************", _
Destination:=Range("a1"))
.Name = "main.php?cid=5516"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "2"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False

I would like this part ie With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.************************", _
Destination:=Range("a1"))
to use an url from a cell rather than a fixed link

Sorry if I have descibed this problem poorly.


  #2   Report Post  
Posted to microsoft.public.excel.misc
pinmaster
 
Posts: n/a
Default How to do automatic Web Queries??


Hi, I wanted to do excatly that a few months ago, so I was able to come
up with this:
connstring = Range("Sheet2!B2").Value
With ActiveSheet.QueryTables.Add(Connection:=connstring ,

you will have to add "URL;" to your cell.

HTH
JG


--
pinmaster
------------------------------------------------------------------------
pinmaster's Profile: http://www.excelforum.com/member.php...fo&userid=6261
View this thread: http://www.excelforum.com/showthread...hreadid=490455

  #3   Report Post  
Posted to microsoft.public.excel.misc
Ron Coderre
 
Posts: n/a
Default How to do automatic Web Queries??

Try something like this:

Dim URL2Use as String
URL2Use = "URL;" & Sheet1.Range("B11").Value

With ActiveSheet.QueryTables.Add(Connection:=URL2Use,
Destination:=Range("A1"))


Does that help?

***********
Regards,
Ron


"Alarmbloke" wrote:

Hi,

I would like to be able to import data automatically from a web page without
having to type in the web address.

I can create the correct url path in a cell using a CONCATENATE function but
cannot create a macro which references to that cell for the url look up.

This is the macro as it currently stands


With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.************************", _
Destination:=Range("a1"))
.Name = "main.php?cid=5516"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "2"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False

I would like this part ie With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.************************", _
Destination:=Range("a1"))
to use an url from a cell rather than a fixed link

Sorry if I have descibed this problem poorly.


  #4   Report Post  
Posted to microsoft.public.excel.misc
Alarmbloke
 
Posts: n/a
Default How to do automatic Web Queries??

Hi, yes that worked great, just needed a _ adding
ie
Dim URL2Use as String
URL2Use = "URL;" & Sheet1.Range("B11").Value

With ActiveSheet.QueryTables.Add(Connection:=URL2Use, _
Destination:=Range("A1"))


Thanks very much, am in your debt!!!!

"Ron Coderre" wrote:

Try something like this:

Dim URL2Use as String
URL2Use = "URL;" & Sheet1.Range("B11").Value

With ActiveSheet.QueryTables.Add(Connection:=URL2Use,
Destination:=Range("A1"))


Does that help?

***********
Regards,
Ron


"Alarmbloke" wrote:

Hi,

I would like to be able to import data automatically from a web page without
having to type in the web address.

I can create the correct url path in a cell using a CONCATENATE function but
cannot create a macro which references to that cell for the url look up.

This is the macro as it currently stands


With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.************************", _
Destination:=Range("a1"))
.Name = "main.php?cid=5516"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "2"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False

I would like this part ie With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.************************", _
Destination:=Range("a1"))
to use an url from a cell rather than a fixed link

Sorry if I have descibed this problem poorly.


  #5   Report Post  
Posted to microsoft.public.excel.misc
Alarmbloke
 
Posts: n/a
Default How to do automatic Web Queries??

Hi,

This worked a treat thanks, just needed a _ adding as below

connstring = Range("Sheet2!B2").Value
With ActiveSheet.QueryTables.Add(Connection:=connstring , _


"pinmaster" wrote:


Hi, I wanted to do excatly that a few months ago, so I was able to come
up with this:
connstring = Range("Sheet2!B2").Value
With ActiveSheet.QueryTables.Add(Connection:=connstring ,

you will have to add "URL;" to your cell.

HTH
JG


--
pinmaster
------------------------------------------------------------------------
pinmaster's Profile: http://www.excelforum.com/member.php...fo&userid=6261
View this thread: http://www.excelforum.com/showthread...hreadid=490455


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
options to update automatic links Werner Rohrmoser Excel Worksheet Functions 0 November 10th 05 12:58 PM
change data source for many queries at once? Sam Raymond Excel Worksheet Functions 0 July 11th 05 04:59 PM
automatic query refresh sid Excel Discussion (Misc queries) 1 March 14th 05 09:02 PM
automatic query refresh sid Excel Discussion (Misc queries) 0 March 14th 05 08:55 AM
Excel 2003 This Workbook contains queries to external data Puzzled of Springburn Excel Discussion (Misc queries) 0 February 8th 05 03:21 PM


All times are GMT +1. The time now is 09:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"