Solved

Get result

Posted on 2006-11-07
4
173 Views
Last Modified: 2010-05-03
I am using the following sections of code:

Set fs = CreateObject("Scripting.FileSystemObject")
fs.DeleteFile("c:\*.bak")

and

fs.CopyFile "source.dat", "c:\backup.bak"


how can i get results from these commands to check that they have completed successfully or not?
0
Comment
Question by:xizor
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
JackOfPH earned 125 total points
Comment Utility
Try to use on error...

On error Goto err1:
Set fs = CreateObject("Scripting.FileSystemObject")
fs.DeleteFile("c:\*.bak")

msgbox("Delete Successful")
Exit sub

err:
msgbox("delete not successful")
0
 
LVL 15

Expert Comment

by:JackOfPH
Comment Utility
or

On error Goto err1:

fs.CopyFile "source.dat", "c:\backup.bak"
msgbox("Copy Successful")
Exit sub

err:
msgbox("Copy not successful")
0
 
LVL 2

Author Comment

by:xizor
Comment Utility
I'm already using an on error for the procedure, i was wondering if there was anyway to get a result from these particular commands.

For example, I am not using force delete opn read only files, so when i made a file read only, it doesn't get deleted, but it doesn't get picked up as an error either.
0
 
LVL 2

Author Comment

by:xizor
Comment Utility
oh...ignore that....

I dont know why, but when i first tested it i got no error....

then trying some other stuff.. it came back... permission denied...

thanks
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…

772 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

12 Experts available now in Live!

Get 1:1 Help Now