Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I use the ActiveCell's contents as a string for a web query


I am trying to set up a macro which will use a web query to retrieve
files corresponding to the data in row 1 of my spreadsheet (ie. a list
of values for each name in row1).

So, essentially I want to have a series of names in row 1 (ie.
A1=Smith, B1=Jones, C1=Dudley etc), and then have the macro so that
each of them returns a web query from the address
http://www.class.com/[value].txt (so that it returns a query from
http://www.class.com/Smith.txt etc.)

I have set up the macro so that it asks me which name to query (ie. I
have worked out how to do a dynamic web query), and so that the
ActiveCell is the correct cell, but I still have to click the cell each
time.

Can somebody please help me.


--
thebird
------------------------------------------------------------------------
thebird's Profile: http://www.excelforum.com/member.php...o&userid=24515
View this thread: http://www.excelforum.com/showthread...hreadid=381113

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default How do I use the ActiveCell's contents as a string for a web query

Dim Qt As QueryTable
Dim Sht As Worksheet
Dim strWebAddr As String
Dim i As Integer

Set Sht = ActiveSheet
Set Qt = Sht.QueryTables(1)

For i = 0 To 255
If ActiveCell.Offset(0, i).Value < "" Then
strWebAddr = ActiveCell.Offset(0, i).Value
With Qt
.Connection = "URL;" & strWebAddr
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "22"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.Refresh BackgroundQuery:=False
End With
Else
Exit For
End If
Next i
End Sub


"thebird" wrote in
message ...

I am trying to set up a macro which will use a web query to retrieve
files corresponding to the data in row 1 of my spreadsheet (ie. a list
of values for each name in row1).

So, essentially I want to have a series of names in row 1 (ie.
A1=Smith, B1=Jones, C1=Dudley etc), and then have the macro so that
each of them returns a web query from the address
http://www.class.com/[value].txt (so that it returns a query from
http://www.class.com/Smith.txt etc.)

I have set up the macro so that it asks me which name to query (ie. I
have worked out how to do a dynamic web query), and so that the
ActiveCell is the correct cell, but I still have to click the cell each
time.

Can somebody please help me.


--
thebird
------------------------------------------------------------------------
thebird's Profile:
http://www.excelforum.com/member.php...o&userid=24515
View this thread: http://www.excelforum.com/showthread...hreadid=381113



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
read contents of column 1 for particular string Bob Excel Discussion (Misc queries) 1 November 4th 07 10:18 PM
Searching in another workbook for a string and returning with the contents of the cell next to it. [email protected] Excel Worksheet Functions 1 January 12th 07 07:50 PM
IF Cell Contents Start with STRING ConfusedNHouston Excel Worksheet Functions 2 April 17th 06 03:28 PM
MS Query DateTime String Dean Excel Worksheet Functions 1 January 23rd 06 12:07 PM
Syntax for ADO Query String John Excel Programming 1 January 17th 05 08:49 AM


All times are GMT +1. The time now is 02:51 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"