• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 182
  • Last Modified:

FileSystemObject -- Cant Create Object Error

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
sakibomber
Asked:
sakibomber
  • 3
  • 2
  • 2
  • +3
1 Solution
 
Brendt HessSenior DBACommented:
YOu need quotation marks:

fs = CreateObject("Scripting.FileSystemObject")
0
 
Brendt HessSenior DBACommented:
oops - you also need a Set:

Set fs = CreateObject("Scripting.FileSystemObject")

(see what happens when you type too fast? :-)
0
 
rspahitzCommented:
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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
jayeshshahCommented:
0
 
kishore1977Commented:
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
 
Anthony PerkinsCommented:
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
 
rspahitzCommented:
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
 
sakibomberAuthor Commented:
Sorry for the delay.......Ive gotta reject your proposed solution kishore.  Sorry but its only fair.
0
 
sakibomberAuthor Commented:
Thank you...sorry for the delayed response. :)


saki
0
 
rspahitzCommented:
sakibomber, thanks for the "A", and thanks for getting back to this Q.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now