
URLs not enabled in Textbox control
Quote:
> I wish to display the following text in the control.
Please do not multipost the same message to several groups.
If a question is relavant to more than one group, select the two or
three most relavant and crosspost to them only. Replies to your
multiposted messages do not show up in the other groups, thereby
perhaps causing many to duplicate work already done, and those
in the other groups do not gain from any answers that might solve
the problem.
This reply has been crossposted to the Syntax group by adding
that group to the TO line, that is how you would crosspost your
original questions. This and any replies under it will now be viewable
in both groups. That allows everyone from both groups to see the
replies and contributte to the discussion.
Here is one method when you know IE 4 or higher will be installed.
In a new project go to Project>Components and add Microsoft
Internet Controls. That will add the WebBrowser object to your
VB Toolbar. Place that control on a new form. Then go to
Project>References and check off Microsoft HTML Object Library.
Now paste the following code to the new form and try it out:
HTH
LFS
Option Explicit
' REQUIRED REFERENCES:
' Microsoft HTML Object Library
' Microsoft Internet Controls
' REQUIRED COMPONENT
' Microsoft Internet Controls
' (WebBrowser)
Private Sub Form_Load()
Dim Msg As String
Msg = Msg & "<HTML><HEAD></HEAD><BODY>"
Msg = Msg & "Welcome to the new release of ... <BR>"
Msg = Msg & "<P>To know what's new in this release ... <BR>"
Msg = Msg & "<A HREF='http://www.google.com' TARGET='new'>www.google.com</A>"
Msg = Msg & "<P>We look forward ...<BR>"
Msg = Msg & "</BODY></HTML>"
Show
Document = Msg
End Sub
Private Sub Form_Resize()
WebBrowser1.Move 0, 0, ScaleWidth, ScaleHeight
End Sub
Public Property Get Document() As String
'Returns HTML document from Browser
Dim Doc As HTMLDocument
If WebBrowser1.ReadyState = READYSTATE_COMPLETE Then
Set Doc = WebBrowser1.Document
If Not Doc Is Nothing Then
Document = Doc.documentElement.innerHTML
Set Doc = Nothing
End If
End If
End Property
Public Property Let Document(ByVal NewValue As String)
'Writes a new (text or HTML) document to Browser
Dim IDoc As IHTMLDocument
On Error GoTo DocError
WebBrowser1.Navigate2 "about:blank", 2
DoEvents
If Len(NewValue) Then
Set IDoc = WebBrowser1.Document
IDoc.open "text/html", "replace"
IDoc.write NewValue
IDoc.Close
Set IDoc = Nothing
End If
DocError:
End Property