How to Retreive the Source code of a web page
Posted on January 4, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 'Internet - How to Retreive the Source code of a web page Option Explicit 'Place the following controls on a form: RichTextBox1 (Rich Textbox); 'Inet1 (Internet Control); Text1 (Textbox); Command1 (Command button) Private Sub Command1() Dim Source1 As String If Len(Text1) > 0 Then ' We'll assume the User entered a URL for Download Source1 = Inet1.OpenURL(Me.Text1.Text) If Len(Source1) > 0 Then RichTextBox1.Text = Source1 Me.Inet1.Cancel Else Source = MsgBox("Source code is not available.", vbInformation, "Source Code") End If End If End Sub |
March 22nd, 2010 - 15:38
I could not get this code to work as posted. Maybe I was doing something wrong. I re-wrote the code as listed below, which did work for me.
Option Explicit
Private Sub Form_Load()
Dim mySource As String
Inet1.URL = “http://www.SomeUrl”
mySource = Inet1.OpenURL(Inet1.URL)
RichTextBox1 = mySource
End Sub