Solved

VB6 Classic - Webbrowser double click

Posted on 2015-01-16
5
76 Views
Last Modified: 2015-02-13
Hi

Yes, still using Classic :-)

Would anyone have some code that shows how to double click text on a Web page and then throw it to the Clipboard, based on certain criteria? In my case, I need to allow thi scenario only when the text matches four letters and seven numbers I.e ABCD1234567.

Thanks.
0
Comment
Question by:tvtech
  • 2
5 Comments
 
LVL 20

Expert Comment

by:ltlbearand3
Comment Utility
Can you use one of the browser objects to open the page and extra the data from the HTML source that way?  Maybe something like one of these:

When you say click on text, is the text a hyperlink and you want the value that comes from the link?

Dim objHttp, objXMLDoc

Set objHttp = CreateObject("MSXML2.ServerXMLHTTP.6.0")
Set objXMLDoc = CreateObject("Msxml2.DOMDocument") 

With objHttp
	.Open "GET", "http://www.yoursite.com"
	.Send
	objXMLDoc.LoadXML .responseText
End With

msgbox objXMLDoc.SelectSingleNode("//YourNodeName").text

set objHttp = nothing
set objXMLDoc = nothing

Open in new window


Sub GetWebTitle()
	' Need References set to 
      ' MICROSOFT INTERNET CONTROLS
      ' MICROSOFT HTML OBJECT LIBRARY

    Dim objHTML As HTMLDocument
    Dim objTitleElem As IHTMLElementCollection
    Dim objIE As InternetExplorer
    
    Set objIE = New InternetExplorer
    
    With objIE
        ' Enter in the website here
        .navigate "http://www.experts-exchange.com/"
        
        ' Don't show IE as we open it
        .Visible = False
        
        ' Pause while IE Loads
        Do While .Busy Or .readyState <> READYSTATE_COMPLETE
            DoEvents
        Loop
        
        ' Load the web page into an HTML Document
        Set objHTML = .document
    End With
    
    ' Look for the all instances of the tag
    Set objTitleElem = objHTML.getElementsByTagName("Title")
    
    
    ' Put the value from the first instance in cell A1
    Range("A1").Value = objTitleElem.Item(0).outerText
    
End Sub

Open in new window

0
 

Author Comment

by:tvtech
Comment Utility
Thanks for your comment.

The text is not hyperlinked. Just plain text.
0
 
LVL 20

Accepted Solution

by:
ltlbearand3 earned 500 total points
Comment Utility
Since it is plan text, I suggest looking at one of the methods I posted.  You could always do a view source from the web page to see how the data is stored and then use one of the examples posted to help parse the data.
0
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now