ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Interpret HTML in excel worksheet (https://www.excelbanter.com/excel-programming/336862-interpret-html-excel-worksheet.html)

[email protected]

Interpret HTML in excel worksheet
 
Hi,

I am grabbing some data from an html table using the following code:


-----------------------------------------------------------------------------
Dim url As String
Dim startTag As String
Dim endTag As String
Dim playerStats As Variant
Dim newPlayerArray As Variant
Dim counter As Single
'""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""
' player import
'""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""

url =
"http://www.sportsline.com/nhl/stats/playersort/regularseason/yearly/NHL/?&print_rows=9999"
startTag = "<div class=SLTables1"
endTag = "</div"


playerStats = gsGetString(url, startTag, endTag)

------------------------------------------------------------------------------

What I want to be able to do is take playerStats and PasteSpecial -
Unicode into Worksheets("test").Range("A1")

This will properly form a worksheet with all the statistics I am
looking for.

Any ideas would be appreciated.

Thanks
Dave


Dick Kusleika[_4_]

Interpret HTML in excel worksheet
 
Dave

You can put that text into the clipboard using a DataObject, then use
PasteSpecial normally. The DataObject object is part of the Microsoft Forms
2.0 Library, so you'll need to set a reference if you haven't already
(Tools - References). Your code will look something like

Set objData as New DataObject

objData.SetText = playerStats
objData.PutInClipBoard

Sheet1.Range("A1").Select
Sheet1.PasteSpecial "Unicode Text"

See http://www.dicks-blog.com/archives/2...l-in-cells-ii/ for
another example using DataObject.


--
Dick Kusleika
Excel MVP
Daily Dose of Excel
www.dicks-blog.com



wrote:
Hi,

I am grabbing some data from an html table using the following code:


-----------------------------------------------------------------------------
Dim url As String
Dim startTag As String
Dim endTag As String
Dim playerStats As Variant
Dim newPlayerArray As Variant
Dim counter As Single
'""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""
' player import
'""""""""""""""""""""""""""""""""""""""""""""""""" """"""""""""""""""""

url =
"http://www.sportsline.com/nhl/stats/playersort/regularseason/yearly/NHL/?&print_rows=9999"
startTag = "<div class=SLTables1"
endTag = "</div"


playerStats = gsGetString(url, startTag, endTag)

------------------------------------------------------------------------------

What I want to be able to do is take playerStats and PasteSpecial -
Unicode into Worksheets("test").Range("A1")

This will properly form a worksheet with all the statistics I am
looking for.

Any ideas would be appreciated.

Thanks
Dave




Daveed[_2_]

Interpret HTML in excel worksheet
 
Thanks very much. I will give that a shot tonite when I get home.
Much appreciated!!



All times are GMT +1. The time now is 12:14 AM.

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