Solved

FTP Object not set problem error 91

Posted on 1998-12-17
5
146 Views
Last Modified: 2010-05-03
I get error 91 with the following code on the RemoteHost line why?

Dim FTP As FTP

Private Sub Command1_Click()
FTP.RemoteHost = "Host"
FTP.UserId = "Login"
FTP.Password = "Pass0"
FTP.RemotePort = "21"
0
Comment
Question by:louy
  • 3
  • 2
5 Comments
 
LVL 10

Expert Comment

by:caraf_g
ID: 1451037
Your object variable is not set to anything; there are two ways around this:

1 As the first line of sub Command1_Click(), insert:
Set FTP = New FTP

2 Dim FTP As New FTP

PS - You should really try to avoid using type names as variable names, so use Dim objFTP As FTP and modify your code:

Dim objFTP As FTP

Private Sub Command1_Click()
Set objFTP = New FTP
objFTP.RemoteHost = "Host"
objFTP.UserId = "Login"
objFTP.Password = "Pass0"
objFTP.RemotePort = "21"

0
 

Author Comment

by:louy
ID: 1451038
Getting invalid use of new keyword error, any ideas?

0
 
LVL 10

Accepted Solution

by:
caraf_g earned 50 total points
ID: 1451039
Louy,

The FTP class is defined as not creatable.

Perhaps there is a method of some other object you can use?

For example:
Set objFTP = someobject.CreateFTP(<parameters>) or something like that?

You'll have to check up on the help/definition of the "FTP" class and other associated classes to find out what the correct procedure is for instantiating objects of type FTP.
0
 

Author Comment

by:louy
ID: 1451040
Could never get it to work.  Am using IP works tools that actually work.
0
 
LVL 10

Expert Comment

by:caraf_g
ID: 1451041
Er, thanks for the points but in that case I didn't deserve them!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now