Solved

FTP Object not set problem error 91

Posted on 1998-12-17
5
143 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
Comment Utility
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
Comment Utility
Getting invalid use of new keyword error, any ideas?

0
 
LVL 10

Accepted Solution

by:
caraf_g earned 50 total points
Comment Utility
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
Comment Utility
Could never get it to work.  Am using IP works tools that actually work.
0
 
LVL 10

Expert Comment

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

771 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

11 Experts available now in Live!

Get 1:1 Help Now