Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help starting Inet application

Status
Not open for further replies.

jlindahl

Programmer
Sep 23, 2003
46
US
By now, I'm as confused as I was when I began this journey. I understand that there is an Inet control, but I am trying use this control without having to have a form to place it on. How do you get the Inet control started?
Here is my code:
Code:
Option Explicit
    Public Inet1 As InetCtlsObjects.Inet

Public Sub Main()
    Inet1.AccessType = icUseDefault
    With Inet1
        .URL = "ftp://test"
        .UserName = "rrrrr"
        .Password = "rrrrr"
        .Execute , "PUT", "C:\GAS.txt"
        .Execute , "CLOSE"
    End With
End sub

when ran, this is my error "Run-time error '91': Object variable or With block variable not set"
 
You haven't set inet1 to anything, you have dimensioned the variable but not created the object.

try adding these lines:

Option Explicit
Public Inet1 As InetCtlsObjects.Inet

Public Sub Main()
' ADD THIS LINE
Set Inet1 = New InetCtlsObjects.Inet
Inet1.AccessType = icUseDefault
With Inet1
.URL = "ftp://test"
.UserName = "rrrrr"
.Password = "rrrrr"
.Execute , "PUT", "C:\GAS.txt"
.Execute , "CLOSE"
End With
'ADD THIS LINE TOO
Set Inet1 = Nothing
End sub

I'm not too sure weather this will actually work, because I don't know if the control can be created with out a form but it should help a bit.

Matt

If you can keep your head while those around you are losing theirs, you obviously haven't grasped the seriousness of the situation
 
I gave it a try, but it still did not work. I get an 'invalid use of New keyword.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top