Solved

FileSystemObject -- Cant Create Object Error

Posted on 2002-07-30
10
165 Views
Last Modified: 2010-05-01
Does anyone know why I get an error (Cant Create Object) when I try this???

fs= CreateObject(Scripting.FileSystemObject)


I need to create a file system object in order to delete certain files requested by the user. This seems to be ok until I bundle my app with FailSafe.  I receive a failsafe error that states that I cant create the object.


thanks,

saki
0
Comment
Question by:sakibomber
  • 3
  • 2
  • 2
  • +3
10 Comments
 
LVL 32

Expert Comment

by:bhess1
ID: 7188924
YOu need quotation marks:

fs = CreateObject("Scripting.FileSystemObject")
0
 
LVL 32

Expert Comment

by:bhess1
ID: 7188926
oops - you also need a Set:

Set fs = CreateObject("Scripting.FileSystemObject")

(see what happens when you type too fast? :-)
0
 
LVL 22

Accepted Solution

by:
rspahitz earned 75 total points
ID: 7189405
A much easier way to delete files, without any additional components such as FSO is to simply use "Kill".

Ex.

Kill "C:\Temp\Somefile.txt"

This is an intrinsic VB command so as long as you have the VB run-time engine (which is required to run your app) then this functionality is available.

the only minor issue is that you should include error-trapping in case the delete fails.
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 5

Expert Comment

by:jayeshshah
ID: 7191410
0
 
LVL 1

Expert Comment

by:kishore1977
ID: 7193171
A much easier way to delete files, without any additional components such as FSO is to simply use "Kill".

Ex.

Kill "C:\Temp\for.txt"

This is an intrinsic VB command so as long as you have the VB run-time engine (which is required to run your app) then this functionality is available.

the only minor issue is that you should include error-trapping in case the delete fails.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7193500
kishore1977,

Is that the best you can do?  Copy someone else's answer? This may be your first day on EE, but that is not the way we do it here.  

Do yourself a favor and re-read the EE Guidelines (http://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp) regarding posting answers as comments.

Anthony
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 7194130
kishore1977, I can't help but laugh.  I've seen people copy and then re-state a possible answer in their own words, but yours was a verbatim copy.  All I can think is that you liked my comment so much that you wanted to submit it as an answer.

I'm honored!

However, as Anthony pointed out, that's not the proper way to use Experts Exchange.  Welcome aboard and I hope you'll be more careful next time.  (FYI, most experts will only use the Comment button since they realize that their answers may only be part of what the questioner is seeking.)
0
 

Author Comment

by:sakibomber
ID: 7206734
Sorry for the delay.......Ive gotta reject your proposed solution kishore.  Sorry but its only fair.
0
 

Author Comment

by:sakibomber
ID: 7206738
Thank you...sorry for the delayed response. :)


saki
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 7206749
sakibomber, thanks for the "A", and thanks for getting back to this Q.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

808 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