When that code failed to work for me I read up on the Inet control in the Object Browser. After very little reading I modified the CodeItBetter sample with the code below. I was pleasantly surprised to see the RTB fill with source code.
- Code: Select all
Private Sub Form_Load()
Dim strSrc As String
' Inet1.URL = "http:/www.nothing" ' MsgBox bad URL test string
Inet1.URL = "http://www.martin2k.co.uk/"
strSrc = Inet1.OpenURL(Inet1.URL)
If Len(strSrc) > 0 Then
RichTextBox1 = strSrc
MsgBox "Source code is not available.", vbInformation, "Page Error"