Solved

VB6 Classic - Webbrowser double click

Posted on 2015-01-16
5
84 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
ID: 40554707
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
ID: 40555763
Thanks for your comment.

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

Accepted Solution

by:
ltlbearand3 earned 500 total points
ID: 40555840
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 47

Expert Comment

by:Martin Liss
ID: 40607543
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

679 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