Solved

VB6 Classic - Webbrowser double click

Posted on 2015-01-16
5
78 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 46

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

861 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

26 Experts available now in Live!

Get 1:1 Help Now