Solved

FTP Object not set problem error 91

Posted on 1998-12-17
5
155 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Determine Range to Select 5 56
Microsoft Access combo box help 2 52
Child Form in front 4 57
Export Data to Different .csv Files 26 121
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

726 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