Solved

FileSystemObject -- Cant Create Object Error

Posted on 2002-07-30
10
168 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
[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
  • 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
Independent Software Vendors: 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!

 
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

Technology Partners: 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

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 …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

749 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