Solved

FileSystemObject -- Cant Create Object Error

Posted on 2002-07-30
10
173 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:Brendt Hess
ID: 7188924
YOu need quotation marks:

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

Expert Comment

by:Brendt Hess
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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
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…
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…
Suggested Courses
Course of the Month4 days, 9 hours left to enroll

635 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