Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Word, PowerPoint, Outlook, and Other Office Products > how to get website data via excel


Reply
 
Thread Tools Display Modes
  #1  
Old 12-02-2006, 07:20 AM
vinsie vinsie is offline
Junior Contributor
 
Join Date: Apr 2005
Posts: 355
Default how to get website data via excel


Hello, I need via (Office EXCEL XP) to get Internet Data,
I use Database(D), Import other data(D), New web quote (W)
then give me my website, selected table to import. done.


Example: Quote Price
http://finance.yahoo.com/q?s=GOOG
http://finance.yahoo.com/q?s=DELL

Becuase doing this if need changed website link, but my question, can use EXCEL VB do this effect !?


TX1 = "http://finance.yahoo.com/q?s="
TX2 = A1 'GOOG ' 'DELL'...
WEBSITE = TX1 & TX2

Command1_Click = WEBSITE


Any suggest ? Please!
Reply With Quote
  #2  
Old 12-02-2006, 01:03 PM
littlepd's Avatar
littlepd littlepd is offline
Newcomer
 
Join Date: Nov 2006
Location: Lewisville, TX
Posts: 10
Default

Code:
    Dim strConnection as String, strName as String
    strConnection = "http://finance.yahoo.com/q?s=DELL"
    strName = "q?s=DELL"
    With ActiveSheet.QueryTables.Add(Connection:= "URL;" _
                     strConnection, Destination:=Range("A1"))
        .Name = strName
        .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 = "10,13,15,17,19,20"
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With
Reply With Quote
  #3  
Old 12-02-2006, 11:33 PM
vinsie vinsie is offline
Junior Contributor
 
Join Date: Apr 2005
Posts: 355
Default

thank you. I try make this script.
If enter value in Sheet1.G1 ...example (GOOG,DELL)...
and CLICK command buttom.

why some problem...
(A) first click, is correct (show me A5,B5) , and changed value to "DELL"
and next click (A5,B5=DELL), but last data is move to (C5.D5=GOOG)
and next click again (A5,B5,C5,D5,E5,F5...)

what wrong ? can clean last quote value?

(B) can you tell me any method easy select table need. becuase I dull try more times..
.WebTables = 1 , wrong
.WebTables = 6 , wrong
.WebTables = 12 , wrong
.WebTables = 15 , correct

(C) if need Refresh, how to Refresh, I need use SEC, no MIN, any method ?
because I found excel, only 1 min (min), if 10sec,20sec is correct value ?

.RefreshPeriod = 1 'can change 1/2 = 30sec ?



please!






Code:
Sub gethtmltable() Dim sQUOTE As String Dim ds As Worksheet Set ds = Sheets("Sheet1") sQUOTE = ds.Range("G1").Value Dim strConnection As String, strName As String strConnection = "http://finance.yahoo.com/q?s=" & sQUOTE strName = "q?s=" & sQUOTE With ActiveSheet.QueryTables.Add(Connection:="URL;" & strConnection, Destination:=Range("A1")) .Name = strName .FieldNames = True .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuery = True .RefreshStyle = xlInsertDeleteCells .SavePassword = False .SaveData = True .AdjustColumnWidth = True .RefreshPeriod = 1 .WebSelectionType = xlSpecifiedTables .WebFormatting = xlWebFormattingNone .WebTables = 15 .WebPreFormattedTextToColumns = True .WebConsecutiveDelimitersAsOne = True .WebSingleBlockTextImport = False .WebDisableDateRecognition = False .WebDisableRedirections = False .Refresh BackgroundQuery:=False End With End Sub
Reply With Quote
  #4  
Old 12-03-2006, 12:07 PM
littlepd's Avatar
littlepd littlepd is offline
Newcomer
 
Join Date: Nov 2006
Location: Lewisville, TX
Posts: 10
Default

I'm sorry. I have no idea what you are asking.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->