Link to home
Start Free TrialLog in
Avatar of meciab
meciabFlag for Belgium

asked on

Copy & Paste HTML Content

What I want to do is...
Copy HTML content from a web page (via iexplorer) and retrieve the content.
For example if I paste it in a text box I will have the text and not the html, if I paste it in word I will have html content...
Many thx
SOLUTION
Avatar of bossjohnc
bossjohnc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bossjohnc
bossjohnc

This will chop the front of the string off up until you find a keyword that you want...

You might have to do something similar for the end of the text if you really want it to be neat...

strKey = "my keyword"
strData = OpenURL("http://www.myurl.com/mypage.html")

Do While strData <> ""
KLStart:
    Do While strKey <> ""
        strKeyLet = Mid(strKey, 1, 1)
        If Mid(strData, 1, 1) = strKeyLet Then
            strKey = Mid(strKey, 2)
            strData = Mid(strData, 2)
            If strKey = "" Then
                Me.txtMyText = strData
                Exit Sub
            End If
        Else
            If strData = "" Then
                MsgBox "Key Not Found!"
                Exit Sub
            End If
            strData = Mid(strData, 2)
            GoTo KLStart
        End If
    Loop
Loop
Avatar of meciab

ASKER

sorry, but that's not what I want to do, I don't want to retrieve a page from an url.
I want to copy a part of a page, (via iexplorer) and retrieve the html content.
You mean like: right click the page and choose view source, then copy/paste.

or File > SaveAs > Webpage Complete

do you want to do this programatically?


Alan :)
Why don't you use paste special in Word and paste it as unformatted text?

Do you also need to do this progmatically? Here is a link to MS that will help in getting info from the clipboard -  http://support.microsoft.com/?kbid=212730

Here is also some info on using the clipboard: (http://graphicsmagician.com)

Visual Basic: Using the Clipboard with Text
Methods used with the clipboard:


Clipboard.Clear            'clears the clipboard contents
Clipboard.SetText string      'puts 'string' text on the clipboard
Clipboard.GetText()            'returns clipboard's text as a string
Text1.SelText            'refers to selected text,
                  'or cursor's position in text control
Example
Assume txtBox is a Text Box control:


Sub mnuCut_Click ()
    ' empty the clipboard
    Clipboard.Clear
    ' copy the selected text to the clipboard
    Clipboard.SetText txtBox.SelText
    ' and remove the selected text
    txtBox.SelText = ""
End Sub

Sub mnuCopy_Click ()
    ' empty the clipboard
    Clipboard.Clear
    ' and copy the selected text to the clipboard
    Clipboard.SetText txtBox.SelText
End Sub

Sub mnuPaste_Click ()
    ' paste clipboad text into document
    txtBox.SelText = Clipboard.GetText()
End Sub


Avatar of meciab

ASKER

just try something
select the bottom of thise page press ctrl+c then got o word and press ctrl+v
You will have the text formatted. How to retrieve this content
Is there an activeX or any object who can handle html in access.
Thanks
Avatar of meciab

ASKER

Or is a word object can be integreted in access.
where I can paste (from part of html page), write, read data on it and store the content.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you wanted to store pages, you could get them with the code I posted and then view them with the browser control Alan mentions.
If you wanted to store pages, you could get them with the code I posted and then view them with the browser control Alan mentions.