?
Solved

FTP Object not set problem error 91

Posted on 1998-12-17
5
Medium Priority
?
166 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 100 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

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…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Suggested Courses
Course of the Month7 days, 19 hours left to enroll

765 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