CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2006
    Posts
    32

    Please: How to copy text from webpage?

    Pls show me How to copy text from any given webpage to thee ClipBoard.
    I now open the page manually and SelectAll - Copy data from File menu, but would like my program to do the copyin
    Saving text, or the webpage itself, to a text file would also do.

    My form already include WebBrowser1 control, but I have little idea how to use it!
    Last edited by Bruin 1953; February 9th, 2012 at 03:58 AM.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Please: How to copy text from webpage?

    If you search this forum, for webbrowser, I'm sure you can get info quicker than all of us typing our posts, AGAIN. Another keyword is DOM.

    Specify which version of the OS and browser, though. They're different
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Feb 2012
    Posts
    5

    Re: Please: How to copy text from webpage?

    This will get you the text of the web site cant remember how to paste into clipboard


    strURL = "http://www.forexfactory.com"
    Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP")
    objXMLHTTP.Open "GET", strURL, False
    objXMLHTTP.Send ""
    strHTML = objXMLHTTP.ResponseText ' strHTML will contain the text of website strURL

  4. #4
    Join Date
    Sep 2006
    Posts
    32

    Re: Please: How to copy text from webpage?

    Quote Originally Posted by tgacomp View Post
    This will get you the text of the web site cant remember how to paste into clipboard


    strURL = "http://www.forexfactory.com"
    Set objXMLHTTP = CreateObject("MSXML2.ServerXMLHTTP")
    objXMLHTTP.Open "GET", strURL, False
    objXMLHTTP.Send ""
    strHTML = objXMLHTTP.ResponseText ' strHTML will contain the text of website strURL
    Great! Thanks

  5. #5
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Please: How to copy text from webpage?

    Wouldn't count on that last post... or two...
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  6. #6
    Join Date
    Sep 2006
    Posts
    32

    Re: Please: How to copy text from webpage?

    Quote Originally Posted by dglienna View Post
    Wouldn't count on that last post... or two...
    You are probably right!
    I thought I tried it and it worked, but I am finding out that this code return HTML in the page, not the textual data itself.
    So, my request is on!

  7. #7
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Please: How to copy text from webpage?

    You could always use the send keys method

    ctrl a to select all
    ctrl c to copy to clipboard
    Always use [code][/code] tags when posting code.

  8. #8
    Join Date
    Jan 2012
    Posts
    5

    Re: Please: How to copy text from webpage?

    Clipboard.SetText(myvar)

    This should place the text from myvar to the clipboard.

    Check this:
    http://msdn.microsoft.com/en-us/library/tbfb3z56.aspx


    ..
    Last edited by Wario; March 16th, 2012 at 01:55 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured