heres a few more lines of code for that...
the final result is an array of sentences...
im sure you will need to play around a bit, remove blanks etc...
but it works....
[Highlight=VB]
VB Code:
Dim HTML As HTMLDocument Dim hText As String Private Sub Form_Load() Dim tHTML As New HTMLDocument Set HTML = tHTML.createDocumentFromUrl("http://www.yahoo.com", vbNullString) Do While HTML.readyState <> "complete" DoEvents Debug.Print HTML.readyState 'just to see it working Loop hText = HTML.documentElement.innerText Dim tmp As String 'Start new word app Dim wrd As New Word.Application Dim Doc As Word.document 'New Document Set Doc = wrd.Documents.Add Dim dSentences() As String 'just so we can see it.... wrd.Visible = True 'type the "text" into the doc wrd.selection.TypeText Text:=hText 'set each sentence to an element in the array dSentences ReDim dSentences(Doc.Sentences.Count - 1) For x = 1 To Doc.Sentences.Count dSentences(x - 1) = Doc.Sentences(x).Text Next 'loop through and print the array For x = 0 To UBound(dSentences) Debug.Print dSentences(x) Next Doc.Close False wrd.Quit False Set Doc = Nothing Set wrd = Nothing End Sub




Reply With Quote