Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Fetch Text From Website

Hi All,

How can I get the news description from the below mentioned link to a
particular cell (say sheet1, Range("A1") using VBA. Is this possible??

http://www.commercialpropertynews.co..._id=1003559988

Dileep

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Fetch Text From Website

Hi Dileep

I'm not used to this sort of thing but below is the code recorded by
excel while i got the data from the site you gave using a web query
it's very scrappy but it works and should give you an idea of what to
do.

you might want to search help for importing data into excel as well


Sub RunMyCode()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.commercialpropertynews.com/cpn/
article_display.jsp?vnu_content_id=1003559988" _
, Destination:=Range("A1"))
.Name = "article_display.jsp?vnu_content_id=1003559988 "
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = "11"
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub

S

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Fetch Text From Website

Thank you for the suggetion. But how can alter this code to get data
from another page without manually altering the URL in the code?

I need to get data from multiple web pages.

-Dileep

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Fetch Text From Website

Take the code sampleprovided, add a parameter "URL" and then use that to
pass in the URL for each page.

Sub RunMyCode(sURL as String)
With ActiveSheet.QueryTables.Add(Connection:= "URL;" & sURL,
Destination:=Range("A1"))
'etc....



You don't say where your list is kept, so it's difficult to suggest details
of how you might loop through the URL's.

Tim





"Dileep Chandran" wrote in message
ups.com...
Thank you for the suggetion. But how can alter this code to get data
from another page without manually altering the URL in the code?

I need to get data from multiple web pages.

-Dileep



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Fetch Text From Website

Tim,

My URL's are kept in Sheet1 Range("A2:A20"). Any suggetions??

-Dileep



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Fetch Text From Website

Please quote when replying - it makes everyone's life easier.


Try this:

'********************
Dim c as range

for each c in Sheet1.Range("A2:A20")
RunMyCode(c.value)
next c




--
Tim Williams
Palo Alto, CA


"Dileep Chandran" wrote in message ups.com...
Tim,

My URL's are kept in Sheet1 Range("A2:A20"). Any suggetions??

-Dileep



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
fetch values from w/sheet TUNGANA KURMA RAJU Excel Discussion (Misc queries) 0 April 2nd 09 03:43 AM
pasting data from a website changes text to date stebro Excel Discussion (Misc queries) 8 August 12th 06 08:39 PM
Fetch parameters from web into Excel Jonas B Excel Programming 1 May 30th 06 11:11 PM
how to fetch a row and post the row into another sheelt ananthmca2004 Excel Worksheet Functions 1 November 24th 05 03:46 PM
Importing text from a website Weatherlawyer New Users to Excel 10 July 13th 05 04:47 AM


All times are GMT +1. The time now is 03:18 PM.

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

About Us

"It's about Microsoft Excel"