Normally you use a function to return a value. In this case I would think it would be a string, the contents of the web page.
[tt]
Private Sub Command1_Click()
MsgBox GetMyString
End Sub
Private Function GetMyString() As String
GetMyString = "This is a test"
End Function
[/tt]
There are other ways to return value from subs and functions and that is by declaring a variable byref in the arguements of the sub or function...
[tt]
Option Explicit
Private Sub Form_Load()
Dim S As String
MyTest S
MsgBox S
End Sub
Private Sub MyTest(ByRef MyString As String)
MyString = "This is a test"
End Sub
[/tt]
or lets say you wanted to add some other logic to the function that gets the web page and you wanted to know if it was successful or not. You could then return a boolean value and a byref string with the contents....
[tt]
Option Explicit
Private Sub Command1_Click()
Dim MyString As String
If GetWebPage("
MyString) = True Then
'Dowork
End If
End Sub
Private Function GetWebPage(URL As String, ByVal strResult As String) As Boolean
Dim DocumentFactory As HTMLDocument
Dim myHTMLDoc As HTMLDocument
Set DocumentFactory = New HTMLDocument
Set myHTMLDoc = DocumentFactory.createDocumentFromUrl(URL, ""

Do Until myHTMLDoc.readyState = "complete"
DoEvents
Loop
strResult = myHTMLDoc.documentElement.outerHTML
If Len(strResult) <= 41 Then
GetWebPage = False
Else
GetWebPage = True
End If
End Function
[/tt]
I hope this helps, Good Luck