Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Get result

Posted on 2006-11-07
4
Medium Priority
?
199 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 500 total points
ID: 17895364
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
ID: 17895373
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
ID: 17895424
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
ID: 17895506
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses

783 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